Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to disable reply pings v2 #850

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/850.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a new option to disable pinging users on Discord when replying to them on Matrix.
2 changes: 2 additions & 0 deletions config/config.sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ bridge:
disableInviteNotifications: false
# Disable Room Topic echos from matrix
disableRoomTopicNotifications: false
# Disable pinging Discord users on replies in Matrix
disableDiscordReplyPings: false
# Auto-determine the language of code blocks (this can be CPU-intensive)
determineCodeLanguage: false
# MXID of an admin user that will be PMd if the bridge experiences problems. Optional
Expand Down
2 changes: 2 additions & 0 deletions config/config.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ properties:
type: "boolean"
disableRoomTopicNotifications:
type: "boolean"
disableDiscordReplyPings:
type: "boolean"
userActivity:
type: "object"
required: ["minUserActiveDays", "inactiveAfterDays"]
Expand Down
1 change: 1 addition & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class DiscordBridgeConfigBridge {
public disableJoinLeaveNotifications: boolean = false;
public disableInviteNotifications: boolean = false;
public disableRoomTopicNotifications: boolean = false;
public disableDiscordReplyPings: boolean = false;
public determineCodeLanguage: boolean = false;
public activityTracker: UserActivityTrackerConfig = UserActivityTrackerConfig.DEFAULT;
public userLimit: number|null = null;
Expand Down
4 changes: 2 additions & 2 deletions src/matrixeventprocessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ export class MatrixEventProcessor {
}
const replyEmbed = (await this.EventToEmbed(sourceEvent, channel, true)).messageEmbed;

// if we reply to a discord member, ping them!
if (this.bridge.isNamespacedUser(sourceEvent.sender)) {
// if we reply to a discord member and pinging is enabled, ping them!
if (this.bridge.isNamespacedUser(sourceEvent.sender) && !this.config.bridge.disableDiscordReplyPings) {
const uid = this.bridge.getSuffixForUserId(sourceEvent.sender);
replyEmbed.addField("ping", `<@${uid}>`);
}
Expand Down