LengoLabs / qbot

Qbot is an advanced, easy to setup, free, and unbranded Discord-Roblox ranking bot. If at any time during setting it up you need assistance, you can join the support server.
https://discord.gg/J47m7t4
MIT License
75 stars 136 forks source link

custom command/system #40

Closed msami789 closed 3 years ago

msami789 commented 4 years ago

I know this isn’t specific to qbot but for those who don’t know, my bot was on public invite and my group got raided as the bot is in another server.

Does anyone know how I could run a command, (maybe an eval?) to figure out the members of the other server or even get an invite to it.

Thanks.

yogurtsyum commented 4 years ago

Getting the members of another server or getting an invite to it seems like an invasion of privacy. But, you could just leave it with code like this:

async function leaveGuild(){
    let guild = await client.guilds.fetch('GUILD ID');
    guild.leave();
}
leaveGuild();

That could be ran through eval or put in a ready event.

msami789 commented 4 years ago

Getting the members of another server or getting an invite to it seems like an invasion of privacy. But, you could just leave it with code like this:

async function leaveGuild(){
    let guild = await client.guilds.fetch('GUILD ID');
    guild.leave();
}
leaveGuild();

That could be ran through eval or put in a ready event.

How can I add an eval, can’t seem to find the custom commands list?

IeuanGol commented 4 years ago

https://github.com/yogurtsyum/qbot-plugins/blob/master/directory.md#eval-command

msami789 commented 4 years ago

do I have to put the guild id that the bot should leave in “GUILD ID” because I dont have it

IeuanGol commented 4 years ago
client.guilds.cache.map(g => g.id)
msami789 commented 4 years ago

it says that the code complied, where do i find the result?

IeuanGol commented 4 years ago

Restart the bot and see how many servers it's in.

yogurtsyum commented 4 years ago

You could console.log that code that Ieuan provided.

IeuanGol commented 4 years ago

Sorry about that I wasn't thinking properly 😅

IeuanGol commented 4 years ago

Did you manage to solve this?

sv-du commented 4 years ago

Just do this

client.on('ready', async() => {
     let guilds = client.guilds.cache.array();
     for(var i = 0; i < guilds.length; i++) {
          if(guilds[i].id !== "GUILD ID HERE") {
               guild[i].leave();
          }
     }
});
IeuanGol commented 4 years ago

Please could you close this issue if you've solved it now.