Esempio n. 1
0
        public async Task <IDiscordMessage> SendMessage(string message)
        {
            IDMChannel c = await user.CreateDMChannelAsync();

            RuntimeMessage m = new RuntimeMessage(await c.SendMessageAsync(message));

            Log.Message("Sent message to " + user.Username);
            return(m);
        }
Esempio n. 2
0
 public async Task <IDiscordMessage> SendMessage(string message)
 {
     try
     {
         RuntimeMessage m = new RuntimeMessage(await(channel as IMessageChannel).SendMessage(message));
         Log.Message("Sent message to channel " + channel.Name);
         return(m);
     }
     catch
     {
         Log.ErrorAt("SendMessage", "failed to send");
     }
     return(null);
 }
Esempio n. 3
0
        public async Task <IDiscordMessage> SendMessage(string message)
        {
            RuntimeMessage m = null;

            MeruUtils.TryAsync(async() =>
            {
                m = new RuntimeMessage(await(channel as IMessageChannel).SendMessage(message));
                Log.Message("Sent message to channel " + channel.Name);
            },
                               async(ex) =>
            {
                Log.ErrorAt("SendMessage", "failed to send");
            });
            return(m);
        }
Esempio n. 4
0
        public async Task <IDiscordMessage> SendMessage(IDiscordEmbed embed)
        {
            RuntimeMessage m = null;

            try
            {
                Log.Message("Sent embed to channel " + channel.Name);
                m = new RuntimeMessage(
                    await(channel as IMessageChannel)
                    .SendMessageAsync("", false, (embed as IProxy <EmbedBuilder>)
                                      .ToNativeObject()));
            }
            catch (Exception ex)
            {
                Log.ErrorAt("SendMessage", ex.Message);
            }
            return(m);
        }
Esempio n. 5
0
        public async Task <IDiscordMessage> SendMessage(IDiscordEmbed embed)
        {
            RuntimeMessage m = null;
            await MeruUtils.TryAsync(async() =>
            {
                Log.Message("Sent embed to channel " + channel.Name);
                m = new RuntimeMessage(
                    await(channel as IMessageChannel)
                    .SendMessageAsync("", false, (embed as IProxy <EmbedBuilder>)
                                      .ToNativeObject()));
            },
                                     async (ex) =>
            {
                Log.ErrorAt("SendMessage", ex.Message);
            });

            return(m);
        }