I'm trying to check if the user posted a message with a blacklisted word in it and delete the message if the blacklisted word is found however i'm not able to check for the words in any way.i assigned the OnMessageReceived
callback to the MessageReceived
function. I'm kinda new to this so it might be an easy answer but i've been trying to figure it out for the past 2 days.
private async Task OnMessageReceived(SocketMessage msg)
{
for (int i = 0; i < blacklistedWords.Length; i++)
{
if (msg.Content.Contains(blacklistedWords[i]))
{
Console.WriteLine(msg.Author.ToString() + " did a bad");
await msg.Channel.DeleteMessagesAsync(); //I can't find out what to pass in here to delete the message
}
}
}