我正在尝试为我的不和谐服务器制作垃圾邮件过滤器,将其构建到我已有的僵尸网络中 . 完成后,此过滤器将删除任何相同的2条连续消息,以防止复制和粘贴垃圾邮件 . 到目前为止,我已经实现了大部分功能,但我无法弄清楚如何将 Discord.Messages[]
转换为字符串,以便正确比较当前和过去的消息 . 到目前为止我看到的是这样的;
// Spam Filter
discord.MessageReceived += async (s, e) =>
{
var channel = e.Server.FindChannels("general", ChannelType.Text).FirstOrDefault();
var user = discord.CurrentUser;
spamold = spamnew;
Message[] messagesToObtain;
messagesToObtain = await e.Channel.DownloadMessages(1);
spamnew = string.Format(messagesToObtain);
if(spamnew == spamold)
{
Message[] messagesToDelete;
messagesToDelete = await e.Channel.DownloadMessages(2);
await e.Channel.DeleteMessages(messagesToDelete);
};
};
我能够对程序进行足够的修改来运行,但是当它这样做时它没有正确地比较字符串,因此它每发送一次就会不断删除2条消息 . [在下面插入不必要的咆哮]我'm not the best with C#, nor am I in any C language but I understand the very basics such as variable types and the grammatical structure. It'这是一个奇迹我已经成功地使我的机器人不需要在任何论坛上实际寻求帮助(我做了一次,但没有人回答) . 我很高兴能让这件事发挥作用 .