Skip to content
Extraits de code Groupes Projets
Non vérifiée Valider 9b43fcf5 rédigé par Will Hunt's avatar Will Hunt Validation de GitHub
Parcourir les fichiers

Fix #57, filter out webhook messages from us. (#91)

* Fix #57, filter out webhook messages from us.

* chan => msg.channel

* Cast to <Discord.TextChannel>, silly.

* Wrap await

* %$&!? whitespace
parent fdd2b18e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -524,7 +524,7 @@ export class DiscordBot {
});
}
private OnMessage(msg: Discord.Message) {
private async OnMessage(msg: Discord.Message) {
const indexOfMsg = this.sentMessages.indexOf(msg.id);
if (indexOfMsg !== -1) {
log.verbose("DiscordBot", "Got repeated message, ignoring.");
......@@ -535,6 +535,16 @@ export class DiscordBot {
// We don't support double bridging.
return;
}
// Issue #57: Detect webhooks
if (msg.webhookID != null) {
const webhook = (await (<Discord.TextChannel> msg.channel).fetchWebhooks())
.filterArray((h) => h.name === "_matrix").pop();
if (webhook != null && msg.webhookID === webhook.id) {
// Filter out our own webhook messages.
return;
}
}
// Update presence because sometimes discord misses people.
this.UpdateUser(msg.author).then(() => {
return this.GetRoomIdsFromChannel(msg.channel).catch((err) => {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter