所以我整天都在寻找一种向特定用户发送私人消息的方法。我正在制作一个票务系统,我需要将 DM 中的所有票证打印给执行该命令的人。
[Command("createtickets")]
[Description("Creates tickets")]
public async Task createtickets(CommandContext ctx)
{
var interactivity = ctx.Client.GetInteractivity();
string filepath = @"C:\Users\Administrator\Desktop\test.txt";
List<string> lines = new List<string>();
lines = File.ReadAllLines(filepath).ToList();
foreach (string line in lines)
{
Console.WriteLine(line);
}
string[] chars = new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "k", "z", "n", "u", "r", "1", "2", "3", "4", "5", "6", "7", "8", "9" };
Random rnd = new Random();
for (int i=0; i< 9; i++)
{
string randomString = "";
for (int j = 0; j<12; j++)
{
randomString = randomString + chars[rnd.Next(0, 21)];
}
lines.Add(randomString);
}
File.WriteAllLines(filepath,lines);
await ctx.Channel.SendMessageAsync("10 Tickets were written");
var user = ctx.User;
正如你所看到的,有一个包含所有门票的清单,这就是我需要通过 DM 发送的东西。我尝试在 youtube、Discord.net Docs、DSharpplus Docs 以及互联网上的每个论坛上进行搜索,但它们都列出了可能在最近版本中删除的功能。谁能帮我这个?我只需要一种方法来 DM 用户