Example #1
0
        // TODO: Return the message
        /// <summary>
        /// Create a message in the specified channel
        /// </summary>
        /// <param name="channelId">The channel in which to send the message</param>
        /// <param name="content">The message's content</param>
        public async Task <Message> CreateMessage(string channelId, string content)
        {
            var response = await ClientToolbox.PostAsync(DiscordAPI.ChannelMessages(channelId), new Dictionary <string, string>() {
                { "content", content }
            });

            if (response.IsSuccessStatusCode)
            {
                Message message = this.client.CreateStructure <Message>(await response.Content.ReadAsStringAsync());

                // TODO: Should be by reference, Client object may be large
                // Inject client
                return(this.InjectClient(ref message));
            }

            return(null);
        }