コード例 #1
0
ファイル: Extensions.cs プロジェクト: LegendModzYT/Anarchy
 /// <summary>
 /// Sends a message to a channel
 /// </summary>
 /// <param name="channelId">ID of the channel</param>
 /// <param name="message">Contents of the message</param>
 /// <param name="tts">Whether the message should be TTS or not</param>
 /// <returns>The message</returns>
 public static DiscordMessage SendMessage(this DiscordClient client, ulong channelId, string message, bool tts = false, DiscordEmbed embed = null)
 {
     return(client.HttpClient.Post($"/channels/{channelId}/messages", new MessageProperties()
     {
         Content = message, Tts = tts, Embed = embed
     })
            .Deserialize <DiscordMessage>().SetClient(client));
 }
コード例 #2
0
 /// <summary>
 /// Sends a message to the channel
 /// </summary>
 /// <param name="message">Content of the message</param>
 /// <param name="tts">Whether the message should be TTS or not</param>
 /// <returns>The message</returns>
 public DiscordMessage SendMessage(string message, bool tts = false, DiscordEmbed embed = null)
 {
     return(Client.SendMessage(Id, message, tts, embed));
 }
コード例 #3
0
ファイル: TextChannel.cs プロジェクト: skizap/Anarchy
 /// <summary>
 /// Sends a message to the channel
 /// </summary>
 /// <param name="message">Content of the message</param>
 /// <param name="tts">Whether the message should be TTS or not</param>
 /// <returns>The message</returns>
 public DiscordMessage SendMessage(string message, bool tts = false, DiscordEmbed embed = null)
 {
     return(SendMessageAsync(message, tts, embed).Result);
 }
コード例 #4
0
ファイル: TextChannel.cs プロジェクト: skizap/Anarchy
 public async Task <DiscordMessage> SendMessageAsync(string message, bool tts = false, DiscordEmbed embed = null)
 {
     return(await Client.SendMessageAsync(Id, message, tts, embed));
 }
コード例 #5
0
 public EmbedMaker()
 {
     _embed = new DiscordEmbed();
 }
コード例 #6
0
 /// <summary>
 /// Sends a message through the webhook
 /// </summary>
 /// <param name="content">The message to send</param>
 /// <param name="embed">Embed to include in the message</param>
 /// <param name="profile">Custom Username and Avatar url (both are optional)</param>
 public void SendMessage(string content, DiscordEmbed embed = null, DiscordWebhookProfile profile = null)
 {
     SendMessageAsync(content, embed, profile).GetAwaiter().GetResult();
 }
コード例 #7
0
 public async Task SendMessageAsync(string content, DiscordEmbed embed = null, DiscordWebhookProfile profile = null)
 {
     await Client.SendWebhookMessageAsync(Id, Token, content, embed, profile);
 }
コード例 #8
0
 /// <summary>
 /// Sends a message to a channel
 /// </summary>
 /// <param name="channelId">ID of the channel</param>
 /// <param name="message">Contents of the message</param>
 /// <param name="tts">Whether the message should be TTS or not</param>
 /// <returns>The message</returns>
 public static DiscordMessage SendMessage(this DiscordClient client, ulong channelId, string message, bool tts = false, DiscordEmbed embed = null)
 {
     return(client.SendMessageAsync(channelId, message, tts, embed).GetAwaiter().GetResult());
 }
コード例 #9
0
 public static async Task <DiscordMessage> SendMessageAsync(this DiscordClient client, ulong channelId, string message, bool tts = false, DiscordEmbed embed = null)
 {
     return(await client.SendMessageAsync(channelId, new MessageProperties()
     {
         Content = message, Tts = tts, Embed = embed
     }));
 }