Encountered error on event listener CoreMessageParser f

Encountered error on event listener "CoreMessageParser" for event "preMessageParsed" at path "F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js" Type
Error: me.isCommunicationDisabled is not a function
at CoreListener.canRunInChannel (F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js:49:16)
Encountered error on event listener "CoreMessageParser" for event "preMessageParsed" at path "F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js" Type
Error: me.isCommunicationDisabled is not a function
at CoreListener.canRunInChannel (F:\JuyeonJS_chatMod\node_modules\@sapphire\framework\dist\listeners\command-handler\CoreMessageParser.js:49:16)
Old working code started getting this error on any message...
Solution:
anyway you should still migrate to v3.
Jump to solution
13 Replies
Favna
Favna2y ago
wth even is isCommunicationDisabled. I've never seen that before.
private async canRunInChannel(message: Message): Promise<boolean> {
if (isDMChannel(message.channel)) return true;

const me = message.guild!.me ?? (message.client.id ? await message.guild!.members.fetch(message.client.id) : null);
if (!me) return false;

const channel = message.channel as GuildBasedChannelTypes;
const permissionsFor = channel.permissionsFor(me);
if (!permissionsFor) return false;

return permissionsFor.has(this.requiredPermissions, true);
}
private async canRunInChannel(message: Message): Promise<boolean> {
if (isDMChannel(message.channel)) return true;

const me = message.guild!.me ?? (message.client.id ? await message.guild!.members.fetch(message.client.id) : null);
if (!me) return false;

const channel = message.channel as GuildBasedChannelTypes;
const permissionsFor = channel.permissionsFor(me);
if (!permissionsFor) return false;

return permissionsFor.has(this.requiredPermissions, true);
}
it's not in the code that's on GH that's for sure
bomi
bomiOP2y ago
The problem is this function it seems
async canRunInChannel(message) {
if ((0, discord_js_utilities_1.isDMChannel)(message.channel))
return true;
const me = message.guild.me ?? (message.client.id ? await message.guild.members.fetch(message.client.id) : null);
if (!me)
return false;
if (me.isCommunicationDisabled())
return false;
const channel = message.channel;
return channel.permissionsFor(me).has(this.requiredPermissions, false);
}
async canRunInChannel(message) {
if ((0, discord_js_utilities_1.isDMChannel)(message.channel))
return true;
const me = message.guild.me ?? (message.client.id ? await message.guild.members.fetch(message.client.id) : null);
if (!me)
return false;
if (me.isCommunicationDisabled())
return false;
const channel = message.channel;
return channel.permissionsFor(me).has(this.requiredPermissions, false);
}
Favna
Favna2y ago
well that's not the code on GH...
bomi
bomiOP2y ago
This is v2.2.2 I belive
Favna
Favna2y ago
Oh well that's a deprecated version. You should update to v3.
bomi
bomiOP2y ago
I was at 2.2.0 and thought maybe updating would fix
Favna
Favna2y ago
yes it will. v2 is deprecated. what I also dont get is why you update from 2.2.0 to 2.2.2 and not to 2.5.1
bomi
bomiOP2y ago
Great idea thanks
Favna
Favna2y ago
at any rate, update to v3 also isCommunicationDisabled isnt on v2.2.0 / v2.2.2 either:
private async canRunInChannel(message: Message): Promise<boolean> {
if (isDMChannel(message.channel)) return true;

const me = message.guild!.me ?? (message.client.id ? await message.guild!.members.fetch(message.client.id) : null);
if (!me) return false;

const channel = message.channel as GuildBasedChannelTypes;
return channel.permissionsFor(me).has(this.requiredPermissions, false);
}
private async canRunInChannel(message: Message): Promise<boolean> {
if (isDMChannel(message.channel)) return true;

const me = message.guild!.me ?? (message.client.id ? await message.guild!.members.fetch(message.client.id) : null);
if (!me) return false;

const channel = message.channel as GuildBasedChannelTypes;
return channel.permissionsFor(me).has(this.requiredPermissions, false);
}
so idk what you installed
bomi
bomiOP2y ago
I took the function from another folder I had with sapphire 2.2.0 in and copied over the function and its fixed... KEKW No clue why npm gave me this. But thanks favna
Favna
Favna2y ago
I still have no idea where that code came from but sure
Solution
Favna
Favna2y ago
anyway you should still migrate to v3.
Want results from more Discord servers?
Add your server