Skip to content

Commit

Permalink
fix(plugins): remove GuildText if
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Mar 28, 2024
1 parent 8b7433c commit f2c5005
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/plugins/Discord.ts
Expand Up @@ -21,15 +21,13 @@ export const DiscordGenerator = (pluginId: string, fileName: string) => ({
if (Discord.client) {
let channelFound = false;
for (const [ id, channel ] of Discord.client.channels.cache) {
if (channel.type === ChannelType.GuildText) {
if (id === channelName || (channel as TextChannel).name === channelName) {
const ch = Discord.client.channels.cache.find(o => o.id === id);
if (ch) {
(ch as TextChannel).send(await Discord.replaceLinkedUsernameInMessage(message));
chatOut(`#${(ch as TextChannel).name}: ${message} [${Discord.client.user?.tag}]`);
channelFound = true;
break;
}
if (id === channelName || (channel as TextChannel).name === channelName) {
const ch = Discord.client.channels.cache.find(o => o.id === id);
if (ch) {
(ch as TextChannel).send(await Discord.replaceLinkedUsernameInMessage(message));
chatOut(`#${(ch as TextChannel).name}: ${message} [${Discord.client.user?.tag}]`);
channelFound = true;
break;
}
}
}
Expand Down

0 comments on commit f2c5005

Please sign in to comment.