private Response(ResponseType type, string message, ILazySocketMessageChannel channel, ILazySocketUser replyTo = null) { Type = type; Message = message; Channel = channel; ReplyTo = 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)); }
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); }
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 async Task <Response> Changelog(ILazySocketClient client, ILazySocketMessageChannel channel) { var text = @"``` 更新履歴 # v1.0.0 - 2019/09/08 - 使用しているライブラリを更新 # v0.3.11(beta) - 2019/05/30 - 使用しているライブラリを更新 # v0.3.10(beta) - 2019/05/18 - (開発者にのみ影響がある修正) # v0.3.9(beta) - 2019/05/02 - 足し算や引き算の回数が非常に多い式を投稿した際、BOT内部でエラーを出していた問題を修正 # v0.3.8(beta) - 2019/05/01 - 終了後のscanを!scan-showした場合にも""途中経過""と表示されてしまっていた問題を修正 # v0.3.7(beta) - 2019/04/30 - メモリリークが起こっていたと思われる部分を修正 - メンションなしでも、例えば!scan-startのように!を最初につけることでもコマンドが実行できるようになった - !scan-showの--shuffledは--shuffleとも書けるようになった # v0.3.5(beta) - 2019/04/25 - Discord.NETが切断された後に再接続された際、それ以降ダイスなどの結果が多重に書き込まれることがあった問題を修正 # v0.3.4(beta) - 2019/04/23 - scanができなかった問題を修正 # v0.3.3(beta) - 2019/04/21 - 乱数をメルセンヌツイスタに変更 - n面ダイスを振る際、nの値が大きすぎるとオーバーフローする問題を修正 # v0.3.2(beta) - 2019/04/20 - (開発者にのみ影響がある修正) # v0.3.1(beta) - 2019/04/20 - 式にプラスやマイナスを含むダイスロールをした際、結果のテキストにプラスやマイナスが多重に表示されてしまう問題を修正 # v0.3.0(beta) - 2019/04/20 - 全角文字を含むダイスロールをサポート - Scanが削除されるまでの時間を30分から2時間に延長 - BOTの止まる頻度がおそらく低下 - 使用しているライブラリを更新 ```"; return(await Response.TryCreateSayAsync(client, text, await channel.GetIdAsync())); }
public static async Task <Response> Version(ILazySocketClient client, ILazySocketMessageChannel channel) => await Response.TryCreateSayAsync(client, $"version {Texts.Version}", await channel.GetIdAsync());
public static async Task <Response> Help(ILazySocketClient client, ILazySocketMessageChannel channel, string helpMessage) => await Response.TryCreateSayAsync(client, $"{helpMessage}", await channel.GetIdAsync());
public static Response TryCreateSay(string message, ILazySocketMessageChannel channel, ILazySocketUser replyTo = null) { return(TryCreate(ResponseType.Say, message, channel, replyTo)); }
public CacheValue(ILazySocketMessageChannel channel, IList <Response> responses) { Channel = channel ?? throw new ArgumentNullException(nameof(channel)); Responses = responses ?? throw new ArgumentNullException(nameof(responses)); }