首先找到的性格,我是新来的这个东西。我想写一个Discord-bot函数,它在用户在特定频道发送的每条消息的开始处查找一个字符,并且如果该机器人连续两次未找到该字符,则它会执行某些操作。做的东西时,不和谐,机器人不会在通道
string neededCharacter = ">";
if (Dont.FindCharacterTwoTimesInARow.Equals(neededCharacter)) //If you don't find neededCharacter in sent messages two times in a row
{
if (ChannelName.Equal("channel_name")) //look for the specific channel
{
//send message to the channel, stating that the character hasn't been found
await Context.Channel.SendMessageAsync("'>' not found two times in a row");
}
}
注意ChannelName.Equal("channel_text")
和Dont.FindCharacterTwoTimesInARow.Equals(neededCharacter)
是很明显不是真实的东西,他们只是“秀”我想那里做什么?
将是很好,如果有人可以告诉我怎么这样的事情是可能的。提前致谢。
你试过做什么?显示你的尝试,并解释问题出在哪里 – UnholySheep
基本上,我试图寻找通道的名称,但无法找到任何方法在代码中实际执行该操作。这个“大问题”在于我寻找真正的渠道并仅在那里搜索文本。 – CopperCable
您可能想再次看看在您的代码中使用的Context.Channel对象。 –