Exemplo n.º 1
0
 public void Run(IMessageReference <IDiscordMessage> r)
 {
     foreach (var t in r.Decorators)
     {
         t(new MockDiscordMessage(this, r));
     }
 }
Exemplo n.º 2
0
 private static async Task ProcessDecoratorsAsync(
     IMessageReference <IDiscordMessage> msgRef,
     IDiscordMessage msg)
 {
     foreach (var x in msgRef.Decorators)
     {
         await x(msg);
     }
 }
Exemplo n.º 3
0
 public static IMessageReference <IDiscordMessage> ThenEdit(
     this IMessageReference <IDiscordMessage> reference,
     string message     = "",
     DiscordEmbed embed = null)
 {
     reference.PushDecorator(x
                             => x.EditAsync(new EditMessageArgs(message, embed)));
     return(reference);
 }
 public static string GetString(this IMessageReference reference)
 => $"{reference.GuildId?.ToString() ?? "<no guild ID>"}/{reference.ChannelId}/{reference.MessageId?.ToString() ?? "<no message ID>"}";
Exemplo n.º 5
0
 /// <inheritdoc />
 public void Execute(IMessageReference <IDiscordMessage> args)
 {
     QueuedMessages.Enqueue(args);
 }
Exemplo n.º 6
0
 public static IMessageReference <T> Then <T>(this IMessageReference <T> reference, Func <T, Task> fn)
     where T : class
 {
     reference.PushDecorator(fn);
     return(reference);
 }
Exemplo n.º 7
0
 public static IMessageReference <IDiscordMessage> ThenDelete(this IMessageReference <IDiscordMessage> reference)
 {
     reference.PushDecorator(async(msg) => { await msg.DeleteAsync(); });
     return(reference);
 }
Exemplo n.º 8
0
 public static IMessageReference <T> ThenWait <T>(this IMessageReference <T> reference, int milliseconds)
     where T : class
 {
     reference.PushDecorator(_ => Task.Delay(milliseconds));
     return(reference);
 }
Exemplo n.º 9
0
 public MockDiscordMessage(
     MockMessageWorker worker, IMessageReference <IDiscordMessage> reference)
 {
     this.worker    = worker;
     this.reference = reference;
 }
Exemplo n.º 10
0
 public void Execute(IMessageReference <IDiscordMessage> @ref)
 {
     Run(@ref);
 }