private Response(ResponseType type, string message, ILazySocketMessageChannel channel, ILazySocketUser replyTo = null) { Type = type; Message = message; Channel = channel; ReplyTo = replyTo; }
public async Task StartAsync(ILazySocketMessageChannel channel, ILazySocketUser user, bool force, Expr.Main expr, int maxSize, bool noProgress) { if (channel == null) { throw new ArgumentNullException(nameof(channel)); } if (user == null) { throw new ArgumentNullException(nameof(user)); } await StartAsync(await channel.GetIdAsync(), await user.GetIdAsync(), await user.GetUsernameAsync(), force, expr, maxSize, noProgress); }
/// <summary>他の BOT による、Mention を含まないメッセージを作成します。</summary> public static TestLazySocketMessage CreateOtherBotMessage(string context, ILazySocketUser author = null) { var _author = author ?? TestLazySocketUser.AnotherBot; var mentionedUsers = new TestLazySocketUser[] { }.ToReadOnly(); return(new TestLazySocketMessage { Author = _author, Channel = TestLazySocketMessageChannel.Default, Content = $"{context}", MentionedUsers = mentionedUsers }); }
/// <summary>ダイス BOT への Mention を含むメッセージを作成します。</summary> public static TestLazySocketMessage CreateMentionedMessage(string context, ILazySocketUser author = null) { var _author = author ?? TestLazySocketUser.Author; var mentionedUsers = new[] { TestLazySocketUser.MyBot }.ToReadOnly(); return(new TestLazySocketMessage { Author = _author, Channel = TestLazySocketMessageChannel.Default, Content = $"<@{TestLazySocketUser.MyBot.Id}> {context}", MentionedUsers = mentionedUsers }); }
public async Task GetLatestProgressAsync(ILazySocketMessageChannel channel, ILazySocketUser user, bool shuffled) { if (channel == null) { throw new ArgumentNullException(nameof(channel)); } if (user == null) { throw new ArgumentNullException(nameof(user)); } await GetLatestProgressAsync(await channel.GetIdAsync(), await user.GetIdAsync(), shuffled); }
protected abstract Task <Response> InvokeCoreAsync(ILazySocketClient client, ILazySocketMessageChannel channel, ILazySocketUser user);
protected override async Task <Response> InvokeCoreAsync(ILazySocketClient client, ILazySocketMessageChannel channel, ILazySocketUser user) { var noResult = _noResultOption.HasOption; if (noResult) { await _scanMachine.AbortAsync(await channel.GetIdAsync(), await user.GetIdAsync()); } else { await _scanMachine.EndAsync(await channel.GetIdAsync(), await user.GetIdAsync()); } return(Response.None); }
protected override async Task <Response> InvokeCoreAsync(ILazySocketClient client, ILazySocketMessageChannel channel, ILazySocketUser user) { await _scanMachine.GetLatestProgressAsync(channel, user, _shuffledOption.HasOption); return(Response.None); }
protected override async Task <Response> InvokeCoreAsync(ILazySocketClient client, ILazySocketMessageChannel channel, ILazySocketUser user) { var dice = _diceOption.Value ?? Expr.Main.Interpret("1d100").Value; var maxSize = _maxSizeOption.Value ?? int.MaxValue; var noProgress = _noProgressOption.HasOption; var force = _forceOption.HasOption; await _scanMachine.StartAsync(channel, user, force, dice, maxSize, noProgress); return(Response.None); }
protected override async Task <Response> InvokeCoreAsync(ILazySocketClient client, ILazySocketMessageChannel channel, ILazySocketUser user) => await CommandActions.Changelog(client, channel);
public static Response TryCreateSay(string message, ILazySocketMessageChannel channel, ILazySocketUser replyTo = null) { return(TryCreate(ResponseType.Say, message, channel, replyTo)); }
private static Response TryCreate(ResponseType type, string message, ILazySocketMessageChannel channel, ILazySocketUser replyTo = null) { if (message.Length >= 1500) // Discordの文字上限は2000文字(2019/05/02現在) { return(new Response(ResponseType.Caution, "文字列が長すぎるため、結果を返せませんでした。", channel, replyTo)); } return(new Response(type, message, channel, replyTo)); }