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

问题描述

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

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)