Discord.net将DM发送给特定用户?

时间:2020-10-05 22:41:35

标签: c# dsharp+

因此,我整天都在寻找一种向特定用户发送私人消息的方法。我正在制作票务系统,我需要将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,互联网上的每个论坛上进行搜索,但它们都列出了可能在最新版本中删除的功能。谁能帮我这个?我只需要一种方法来管理用户

0 个答案:

没有答案