mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
Update index.ts
This commit is contained in:
parent
b2ddee9d83
commit
6694e3b8db
1 changed files with 6 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Vencord, a Discord client mod
|
* Vencord, a Discord client mod
|
||||||
* Copyright (c) 2023 Vendicated, MrDiamond, ant0n, and contributors
|
* Copyright (c) 2023 Vendicated, Mr Diamond, ant0n and contributors
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -28,20 +28,21 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "_channelMessages",
|
find: "_channelMessages",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /receiveMessage\((\i)\)\{/,
|
match: /receiveMessage\((\w+)\)\{/,
|
||||||
replace: "$&$self.modifyMentions($1);"
|
replace: "$&$self.modifyMentions($1);"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
modifyMentions(message: MessageJSON) {
|
modifyMentions(message: MessageJSON) {
|
||||||
const isReplyToCurrentUser = this.isReplyToCurrentUser(message);
|
|
||||||
if (settings.store.alwaysPingOnReply && isReplyToCurrentUser) {
|
|
||||||
|
|
||||||
|
if (!this.isReplyToCurrentUser(message)) return;
|
||||||
|
|
||||||
|
if (settings.store.alwaysPingOnReply) {
|
||||||
if (!message.mentions.some(mention => mention.id === UserStore.getCurrentUser().id)) {
|
if (!message.mentions.some(mention => mention.id === UserStore.getCurrentUser().id)) {
|
||||||
message.mentions.push(this.getCurrentUserMention());
|
message.mentions.push(this.getCurrentUserMention());
|
||||||
}
|
}
|
||||||
} else if (!settings.store.alwaysPingOnReply && isReplyToCurrentUser) {
|
} else {
|
||||||
|
|
||||||
message.mentions = message.mentions.filter(mention => mention.id !== UserStore.getCurrentUser().id);
|
message.mentions = message.mentions.filter(mention => mention.id !== UserStore.getCurrentUser().id);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue