/// <summary>
        /// Replies to a previously sent message
        /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
        /// </summary>
        /// <param name="client">Client to use</param>
        /// <param name="embeds">Embeds to send</param>
        /// <param name="callback">Callback with the message</param>
        /// <param name="error">Callback when an error occurs with error information</param>
        public void Reply(DiscordClient client, List <DiscordEmbed> embeds, Action <DiscordMessage> callback = null, Action <RestError> error = null)
        {
            MessageCreate newMessage = new MessageCreate
            {
                Embeds = embeds,
            };

            Reply(client, newMessage, callback, error);
        }
Esempio n. 2
0
        /// <summary>
        /// Post a message to a guild text or DM channel.
        /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
        /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken.
        /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
        /// </summary>
        /// <param name="client">Client to use</param>
        /// <param name="channelId">Channel ID to send the message to</param>
        /// <param name="embeds">Embeds to be send in the message</param>
        /// <param name="callback">Callback with the created message</param>
        /// <param name="error">Callback when an error occurs with error information</param>
        public static void CreateMessage(DiscordClient client, Snowflake channelId, List <DiscordEmbed> embeds, Action <DiscordMessage> callback = null, Action <RestError> error = null)
        {
            MessageCreate createMessage = new MessageCreate
            {
                Embeds = embeds
            };

            CreateMessage(client, channelId, createMessage, callback, error);
        }
        /// <summary>
        /// Replies to a previously sent message
        /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
        /// </summary>
        /// <param name="client">Client to use</param>
        /// <param name="message">Message text to send</param>
        /// <param name="callback">Callback with the message</param>
        /// <param name="error">Callback when an error occurs with error information</param>
        public void Reply(DiscordClient client, string message, Action <DiscordMessage> callback = null, Action <RestError> error = null)
        {
            MessageCreate newMessage = new MessageCreate
            {
                Content = message
            };

            Reply(client, newMessage, callback, error);
        }
Esempio n. 4
0
        /// <summary>
        /// Post a message to a guild text or DM channel.
        /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
        /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken.
        /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
        /// </summary>
        /// <param name="client">Client to use</param>
        /// <param name="channelId">Channel ID to send the message to</param>
        /// <param name="message">Content of the message</param>
        /// <param name="callback">Callback with the created message</param>
        /// <param name="error">Callback when an error occurs with error information</param>
        public static void CreateMessage(DiscordClient client, Snowflake channelId, string message, Action <DiscordMessage> callback = null, Action <RestError> error = null)
        {
            MessageCreate createMessage = new MessageCreate
            {
                Content = message
            };

            CreateMessage(client, channelId, createMessage, callback, error);
        }
 /// <summary>
 /// Post a message to a guild text or DM channel.
 /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
 /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken.
 /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
 /// </summary>
 /// <param name="client">Client to use</param>
 /// <param name="channelId">Channel ID to send the message to</param>
 /// <param name="message">Message to be created</param>
 /// <param name="callback">Callback with the created message</param>
 /// <param name="error">Callback when an error occurs with error information</param>
 public static void CreateMessage(DiscordClient client, Snowflake channelId, MessageCreate message, Action <DiscordMessage> callback = null, Action <RestError> error = null)
 {
     if (!channelId.IsValid())
     {
         throw new InvalidSnowflakeException(nameof(channelId));
     }
     message.Validate();
     message.ValidateChannelMessage();
     client.Bot.Rest.DoRequest($"/channels/{channelId}/messages", RequestMethod.POST, message, callback, error);
 }
Esempio n. 6
0
        /// <summary>
        /// Replies to a previously sent message
        /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
        /// </summary>
        /// <param name="client">Client to use</param>
        /// <param name="message">Message to send</param>
        /// <param name="callback">Callback with the message</param>
        /// <param name="error">Callback when an error occurs with error information</param>
        public void Reply(DiscordClient client, MessageCreate message, Action <DiscordMessage> callback = null, Action <RestError> error = null)
        {
            if (message.MessageReference == null)
            {
                message.MessageReference = new MessageReference {
                    MessageId = Id, GuildId = GuildId
                };
            }

            message.Validate();
            client.Bot.Rest.DoRequest($"/channels/{ChannelId}/messages", RequestMethod.POST, message, callback, error);
        }
        /// <summary>
        /// Post a message to a guild text or DM channel.
        /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
        /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken.
        /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
        /// </summary>
        /// <param name="client">Client to use</param>
        /// <param name="channelId">Channel ID to send the message to</param>
        /// <param name="embeds">Embeds to be send in the message</param>
        /// <param name="callback">Callback with the created message</param>
        /// <param name="error">Callback when an error occurs with error information</param>
        public static void CreateMessage(DiscordClient client, Snowflake channelId, List <DiscordEmbed> embeds, Action <DiscordMessage> callback = null, Action <RestError> error = null)
        {
            if (!channelId.IsValid())
            {
                throw new InvalidSnowflakeException(nameof(channelId));
            }
            MessageCreate createMessage = new MessageCreate
            {
                Embeds = embeds
            };

            CreateMessage(client, channelId, createMessage, callback, error);
        }
Esempio n. 8
0
 /// <summary>
 /// Post a message to a guild text or DM channel.
 /// If operating on a guild channel, this endpoint requires the SEND_MESSAGES permission to be present on the current user.
 /// If the tts field is set to true, the SEND_TTS_MESSAGES permission is required for the message to be spoken.
 /// See <a href="https://discord.com/developers/docs/resources/channel#create-message">Create Message</a>
 /// </summary>
 /// <param name="client">Client to use</param>
 /// <param name="channelId">Channel ID to send the message to</param>
 /// <param name="message">Message to be created</param>
 /// <param name="callback">Callback with the created message</param>
 /// <param name="error">Callback when an error occurs with error information</param>
 public static void CreateMessage(DiscordClient client, Snowflake channelId, MessageCreate message, Action <DiscordMessage> callback = null, Action <RestError> error = null)
 {
     message.Validate();
     client.Bot.Rest.DoRequest($"/channels/{channelId}/messages", RequestMethod.POST, message, callback, error);
 }