使用id discord.net向用户发送消息

时间:2020-05-17 03:27:00

标签: c# discord.net

我正在尝试通过批准命令来批准建议,但Recommendations命令有效,但是我似乎很难弄清楚批准命令。

我正在使用消息ID来获取建议并批准它,并使用消息来获取用户的ID来进行建议。

这是命令的代码:

 [Command("approve")]
        public async Task approve(ulong msgID, [Remainder]string approvealMessage)
        {
            IMessage suggestion = await Context.Channel.GetMessageAsync(msgID);


            await Context.Message.DeleteAsync();

            await suggestion.DeleteAsync();

            IUserMessage approvalmessage = await Context.Channel.SendMessageAsync("Suggetion with message ID: " + msgID + " has been approved!");
            await Task.Delay(3000);
            await approvalmessage.DeleteAsync();


            string[] lines = File.ReadAllLines(serversuggestionidsypath + msgID + ".txt");
            string[] array = lines[1].Split(':');
            string suggestionText = array[1];

            await suggestion.Author.SendMessageAsync("Your suggestion below has been approved!\nSuggestion info:\n\nSuggestion: " + suggestionText + "\n\nStaff Input: " + approvealMessage);
        }

我已经尝试了author.sendmessageasync和使用Author获得ID并通过UserExtensions.SendMessageAsync传递消息,这都停止了代码并且不让它下面的任何内容都不运行。

0 个答案:

没有答案