Discord.js后门命令

时间:2018-11-07 21:18:21

标签: node.js discord discord.js

我已经看到我的机器人加入了更多的服务器,但是似乎有些人正在滥用它。

我希望机器人向我不在的服务器发出一次使用邀请,但我的机器人却在。一旦进入服务器,就可以将其删除。就像这样:

^后门“行会ID”。我对编码非常陌生。谢谢!

2 个答案:

答案 0 :(得分:1)

有2种可能的方法,但这两种方法都取决于漫游器在该行会中的权限。

guildid必须替换为ID或与ID等效的变量

  • 方法1:

            foreach (var item in filebox1)
            {
                System.IO.File.Move(item, Path.Combine(destdir, Path.GetFileName(item)));
                ++counter;
                int tmp = (int)((counter* 100) / totfiles);
                bgw.ReportProgress(tmp, "File transfered : " + Path.GetFileName(item));
                Thread.Sleep(100);
            }
    
  • 方法2:

    let guild = client.guilds.get(guildid):
    if (!guild) return message.reply("The bot isn't in the guild with this ID.");
    
    guild.fetchInvites()
        .then(invites => message.channel.send('Found Invites:\n' + invites.map(invite => invite.code).join('\n')))
        .catch(console.error);
    

还有一种过滤SEND_MESSAGE频道的方法,您可以向服务器发送消息

答案 1 :(得分:0)

与其进入公会然后将其删除,不如使用Guild.leave()

使机器人离开公会会更简单。
// ASSUMPTIONS:
// guild_id is the argument from the command
// message is the message that triggered the command

// place this inside your command check
let guild = client.guilds.get(guild_id);
if (!guild) return message.reply("The bot isn't in the guild with this ID.");

guild.owner.send("The bot has been removed from your guild by the owner.").then(() => {
  guild.leave();
});