Wycademy/src/Wycademy/WycademyExtensions.cs
/// <summary>
/// Sends a message to a channel and caches the IDs of the command and response messages.
/// </summary>
/// <param name="channel">The channel to send the message in.</param>
/// <param name="text">The message to send.</param>
/// <param name="commandID">The ID of the command message.</param>
/// <param name="cache">The CommandCacheService to add the IDs to.</param>
/// <param name="prependZWSP">Whether or not to add a zero-width space to the beginning of the message.</param>
/// <param name="file">A Stream to be uploaded with the message.</param>
/// <param name="fileName">The name to use for the uploaded stream.</param>
/// <returns>A Task containing an IUserMessage.</returns>
Sends a message to a channel and caches the IDs of the command and response messages.
Sends a message to a channel and caches the IDs of the command and response messages .
public static async Task<IUserMessage> SendCachedMessageAsync(this IMessageChannel channel, ulong commandID, CommandCacheService cache, string text = "", bool prependZWSP = false, Stream file = null, string fileName = "No Name", EmbedBuilder embed = null)
        {
            IUserMessage m;
            if (file == null)
            {
                m = await channel.SendMessageAsync(prependZWSP ? "\x200b" + text : text, embed: embed);
            }
            else
            {
                m = await channel.SendFileAsync(file, fileName, prependZWSP ? "\x200b" + text : text);
            }
            await Task.Delay(1000);
            cache.Add(commandID, m.Id);
            return m;
        }
public static async Task < IUserMessage > SendCachedMessageAsync ( this IMessageChannel channel , ulong commandID , CommandCacheService cache , string text = " " , bool prependZWSP = false , Stream file = null , string fileName = " " , EmbedBuilder embed = null ) { IUserMessage m ; if ( file == null ) { m = await channel . SendMessageAsync ( prependZWSP ? " \x200b " + text : text , embed : embed ) ; } else { m = await channel . SendFileAsync ( file , fileName , prependZWSP ? " \x200b " + text : text ) ; } await Task . Delay ( 1000 ) ; cache . Add ( commandID , m . Id ) ; return m ; }
Sends a message to a channel and caches the IDs of the command and response messages.
Sends a message to a channel and caches the IDs of the command and response messages .
A Task containing an IUserMessage.
A Task containing an IUserMessage .
IMessageChannel
this
commandID
ulong
The ID of the command message.
The ID of the command message .
cache
CommandCacheService
The CommandCacheService to add the IDs to.
The CommandCacheService to add the IDs to .
text
string
The message to send.
The message to send .
prependZWSP
bool
Whether or not to add a zero-width space to the beginning of the message.
Whether or not to add a zero - width space to the beginning of the message .
file
Stream
A Stream to be uploaded with the message.
A Stream to be uploaded with the message .
fileName
string
The name to use for the uploaded stream.
The name to use for the uploaded stream .
embed
EmbedBuilder
channel
The channel to send the message in.
The channel to send the message in .