示例#1
0
        private static void SendMessage(DiscordClient client, Snowflake?id, MessageCreate message)
        {
            if (!id.HasValue || !id.Value.IsValid())
            {
                return;
            }

            DiscordChannel channel = client.Bot.DirectMessagesByUserId[id.Value];

            if (channel != null)
            {
                channel.CreateMessage(client, message);
                return;
            }

            DiscordUser.CreateDirectMessageChannel(client, id.Value, newChannel => newChannel.CreateMessage(client, message));
        }