Closed xhyrom closed 3 years ago
The description of your issue is not very informative, do you get any errors? What's the expected result? What's the unexpected result? Please elaborate on your issue.
in djs v12 GCommandsGuild
and in djs v13 its return Guild
As long as I put the structure in the index and don't use require() it works.
Can you create a minimal reproducible example, as I am unable to reproduce this?
okay
Reproduce
I was using discord.js v12 and wanted to add my own stuff to the guild object to simplify the code and make everything work well. When I put <guild>.getCommandPrefix()
it printed the prefix.
I wanted stage channel support so I downloaded discord.js v13 and on startup the bot threw me an error that <guild>.getCommandPrefix() is not a function
and I didn't know what to do so I wrote here.
When I tried in djs v13 not to use require("./slash cmd/src/structures/guild")
and put that structure directly in index.js after the defined discord.js
it worked fine.
My structure code is:
const { Structures } = require("discord.js")
module.exports = Structures.extend('Guild', Guild => {
/**
* The GuildStructure structure
* @class
*/
class GCommandsGuild extends Guild {
constructor(...args) {
super(...args)
}
/**
* getCommandPrefix
* @returns {Promise}
*/
async getCommandPrefix() {
return this.client.dispatcher.getGuildPrefix(this.id);
}
/**
* setCommandPrefix
* @returns {Boolean}
*/
async setCommandPrefix(prefix) {
this.client.dispatcher.setGuildPrefix(prefix, this.id);
this.client.emit('commandPrefixChange', this, this._commandPrefix);
}
}
return GCommandsGuild;
})
and in index.js I have:
const Discord = require("discord.js");
require("./slash cmd/src/structures/guild")
const client = new Discord.Client({ intents: ["GUILDS"]});
This is working fine for me on 13.0.0-dev.c850ae10270076c4b2e10b130dd8f88eed4ed201
.
I just downloaded discord.js v13 via npm i discordjs/discord.js
and it throws me this error. Multiple people have complained to me about this in my npm plugin gcommands.
Will you be so good as to try and test it on gcommands while you have the time?
I think you should use npm i discord.js@dev
to install the master branch correctly. However I don't know if this is the problem...
Okay i go try
Thx, it works 😄
Please describe the problem you are having in as much detail as possible:
Include a reproducible code sample here, if possible:
guild.js
index.js
Further details:
Relevant client options:
My structure extend doesnt working in djs v13 | v12 works I have it defined before
new Client()
+ i haveGUILDS
intents innew Client()