【问题标题】:How to send DM messages after triggering comand Dsharp+如何在触发命令 C Sharp 后发送 DM 消息
【发布时间】:2023-02-15 22:43:41
【问题描述】:

我正在制作一个 Discord 机器人,但我遇到了麻烦。我不知道如何在用户触发命令后发送直接消息,我尝试使用 RequireDirectMessage,但在这个命令刚刚变为非活动状态后,我无法在不和谐公会和直接消息中触发它。

【问题讨论】:

    标签: dsharp+


    【解决方案1】:

    您需要创建一个 DM 频道,然后像这样向该频道发送消息

    [Command("senddm"]
    public async Task SendDMExample(CommandContext ctx)
    {
        var DMChannel = await ctx.Member.CreateDmChannelAsync();
        await DMChannel.SendMessageAsync("WhateverYouAreSending");
    }
    

    【讨论】:

      猜你喜欢
      • 2019-02-27
      • 2019-10-17
      • 2021-05-06
      • 1970-01-01
      • 2021-02-20
      • 1970-01-01
      • 2021-04-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多