Discord.net send DMs to a specific user?

549 Views Asked by At

So i've been searching for all day for a method that sends to a specific user a private message. I'm making a ticket system and I need to print all tickets in DM to the person that executed the command.

        [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;

As you can see there is a list with all the tickets and that is the thing i need to send via DM. I've tried searching on youtube, Discord.net Docs, DSharpplus Docs, every forum on the internet but they all list functions that were probably removed on the recent versions. Can anyone help me with this? I just need a way to DM the user

0

There are 0 best solutions below