public async Task InfoAsync(CommandContext ctx, [Description("desc-member")] DiscordMember?member = null) { member ??= ctx.Member; Chicken?chicken = await this.Service.GetCompleteAsync(ctx.Guild.Id, ctx.User.Id); if (chicken is null) { throw new CommandFailedException(ctx, "cmd-err-chicken-none"); } chicken.Owner = member; await ctx.RespondWithLocalizedEmbedAsync(emb => { emb.WithTitle($"{Emojis.Chicken} {chicken.Name}"); emb.WithColor(this.ModuleColor); emb.AddLocalizedTitleField("str-owner", chicken.Owner?.Mention ?? chicken.UserId.ToString(), inline: true); emb.AddLocalizedTitleField("str-value", $"{chicken.SellPrice:n0}", inline: true); emb.AddLocalizedTitleField("str-stats", chicken.Stats.ToString(), inline: true); if (chicken.Stats.Upgrades?.Any() ?? false) { emb.AddField("str-upgrades", chicken.Stats.Upgrades.Select(u => u.Upgrade.Name).JoinWith(", "), inline: true); } emb.WithLocalizedFooter("str-chickens", chicken.Owner?.AvatarUrl); }); }
public async Task Nick(CommandContext ctx, [Description("New nickname")] string nickname, [Description("Member to softban")] DiscordMember?member = null) { if (ctx.Channel.Get(ConfigManager.Enabled) .And(ctx.Channel.GetMethodEnabled())) { await ctx.TriggerTypingAsync(); if (member == null) { member = ctx.Member; } Permissions userPer = ctx.Member.PermissionsIn(ctx.Channel); if (member.Id == ctx.Member.Id && userPer.HasPermission(Permissions.ChangeNickname) || userPer.HasPermission(Permissions.ManageNicknames)) { await member.ModifyAsync(s => s.Nickname = nickname); await ctx.RespondAsync($"Set the nickname of {member.Username} to {nickname}."); } else { throw new Exception("I cannot allow you to do that."); } } }
public async Task CurrencyAsync([Remainder] DiscordMember?member = null) { member ??= (DiscordMember)Context.User; var userDb = await DbContext.GetOrAddAsync(x => x.UserId == member.Id, () => new UserEntity { UserId = member.Id }); if (member.Id == Context.User.Id) { var userVotesDb = await DbContext.GetOrderedListAsync <VoteEntity, DateTime>(x => x.UserId == member.Id, x => x.CreatedAt, true); if (string.IsNullOrEmpty(Configuration.DiscordBotList)) { await ReplyConfirmationAsync(Localization.GamblingCurrencyYou, userDb.Currency, Configuration.Currency); } else { var timeNow = DateTime.UtcNow; if (userVotesDb.Count == 0 || userVotesDb[0].CreatedAt.AddHours(12) < timeNow) { await ReplyConfirmationAsync(Localization.GamblingCurrencyYouVote, userDb.Currency, Configuration.Currency, $"{Configuration.DiscordBotList}/vote", Configuration.Patreon); } else { var nextVoteHumanized = (userVotesDb[0].CreatedAt.AddHours(12) - timeNow).Humanize(3, new CultureInfo(Localization.GetGuildLocale(Context.Guild !.Id)), TimeUnit.Hour, TimeUnit.Second); await ReplyConfirmationAsync(Localization.GamblingCurrencyYouVoted, userDb.Currency, Configuration.Currency, $"{Configuration.DiscordBotList}/vote", nextVoteHumanized, Configuration.Patreon); } } } else { await ReplyConfirmationAsync(Localization.GamblingCurrencyMember, member.FullName(), userDb.Currency, Configuration.Currency); } }
public async Task RolesAsync([Remainder] DiscordMember?member = null) { var roles = (member is null ? Context.Guild !.Roles.Select(x => x.Value) : member.Roles) .Where(x => x.Id != Context.Guild !.EveryoneRole.Id) .OrderByDescending(x => x.Position) .Select(x => $"{x.Mention} • `{x.Id}`") .ToList(); if (roles.Count == 0) { if (member is null) { await ReplyErrorAsync(Localization.AdministrationNoRoles); } else { await ReplyErrorAsync(Localization.AdministrationMemberNoRoles, member.FullName()); } return; } await SendPaginatedMessageAsync(roles, 15, (items, index) => new DiscordEmbedBuilder { Color = RiasUtilities.ConfirmColor, Title = member is null ? GetText(Localization.AdministrationRolesList) : GetText(Localization.AdministrationMemberRolesList, member.FullName()), Description = string.Join("\n", items.Select(x => $"{++index}. {x}")) });
public Task Tickets(DiscordClient c, MessageCreateEventArgs e) { _ = Task.Run(async() => { if (!await _ticketService.HasTicket(e.Channel, e.Author.Id)) { return; } ulong ticketUserId = TicketService.GetTicketUser(e.Channel); IEnumerable <KeyValuePair <ulong, DiscordMember?> > members = c.Guilds.Values.SelectMany(g => g.Members); DiscordMember?member = members.SingleOrDefault(m => m.Key == ticketUserId).Value; if (member is null) { return; // Member doesn't exist anymore // } DiscordEmbed embed = TicketEmbedHelper.GenerateOutboundEmbed(e.Message.Content, e.Author); try { await member.SendMessageAsync(embed).ConfigureAwait(false); } catch (UnauthorizedException) { var builder = new DiscordMessageBuilder(); builder.WithReply(e.Message.Id, true); builder.WithContent("I couldn't message that user! They've either closed their DMs or left all mutual servers!"); await e.Channel.SendMessageAsync(builder); } }); return(Task.CompletedTask); }
private async Task PrintWarningListAsync(CommandContext ctx, List <Warning> warnings, DiscordMember?forMember = null) { InteractivityExtension?interactivity = ctx.Client.GetInteractivity(); DiscordEmbedBuilder embedBuilder = new() { Title = forMember == null ? "Seznam varování" : $"Seznam varování uživatele {forMember.RatherNicknameThanUsername()}", }; List <(string, string)> embedFields = new(); foreach (Warning warning in warnings) { try { DiscordMember warningMember = await ctx.Guild.GetMemberAsync(warning.UserId); DiscordMember issuerMember = await ctx.Guild.GetMemberAsync(warning.IssuerId); embedFields.Add( ($"#{warning.Id}\t{warningMember.RatherNicknameThanUsername()}\t{warning.IssuedAt}\t{issuerMember.RatherNicknameThanUsername()}", warning.Reason) ); } catch (Exception e) { _logger.LogError(e, "Couldn't fetch user or issuer"); } } IEnumerable <Page> pages = interactivity.GeneratePages(embedFields, embedBuilder, 12); await ctx.Channel.SendPaginatedMessageAsync(ctx.Member, pages); }
public async Task XpAsync([Remainder] DiscordMember?member = null) { member ??= (DiscordMember)Context.User; await Context.Channel.TriggerTypingAsync(); var serverAttachFilesPerm = Context.Guild !.CurrentMember.GetPermissions().HasPermission(Permissions.AttachFiles); var channelAttachFilesPerm = Context.Guild !.CurrentMember.PermissionsIn(Context.Channel).HasPermission(Permissions.AttachFiles); if (!serverAttachFilesPerm && !channelAttachFilesPerm) { await ReplyErrorAsync(Localization.XpNoAttachFilesPermission); return; } if (serverAttachFilesPerm && !channelAttachFilesPerm) { await ReplyErrorAsync(Localization.XpNoAttachFilesChannelPermission); return; } await using var xpImage = await Service.GenerateXpImageAsync(member); await Context.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile($"{member.Id}_xp.png", xpImage)); }
// Calculates permissions for the current channel (for inputs). public static bool CanMention( MentionRole?role, DiscordMember?member, DiscordChannel?channel ) { if (role == null) { return(true); } if (member == null || channel == null) { return(false); } Permissions permissions = member.PermissionsIn(channel); bool can_mention = permissions. HasPermission(Permissions.MentionEveryone); if (!can_mention && role.RoleType() == MentionRole.Type.Discord ) { // guaranteed non-null because type is Type.Discord DiscordRole discord_role = role.GetDiscordRole() !; can_mention = (can_mention || discord_role.IsMentionable); } return(can_mention); }
public async Task AllWaifusAsync([Remainder] DiscordMember?member = null) { member ??= (DiscordMember)Context.User; var allWaifus = (await DbContext.GetListAsync <WaifuEntity, CharacterEntity, CustomCharacterEntity>( x => x.UserId == member.Id, x => x.Character !, x => x.CustomCharacter !)) .ToList <IWaifuEntity>(); allWaifus.AddRange(await DbContext.GetListAsync <CustomWaifuEntity>(x => x.UserId == member.Id)); if (allWaifus.Count == 0) { if (member.Id == Context.User.Id) { await ReplyErrorAsync(Localization.WaifuNoWaifus); } else { await ReplyErrorAsync(Localization.WaifuMemberNoWaifus, member.FullName()); } return; } var specialWaifu = allWaifus.FirstOrDefault(x => x.IsSpecial); var specialWaifuString = string.Empty; if (specialWaifu != null) { var specialWaifuStringify = StringifyWaifu(specialWaifu); specialWaifuString = $"❤ {specialWaifuStringify[..specialWaifuStringify.IndexOf('\n')]}";
public static string?GetUsernameWithNickname(this DiscordMember?member) { if (member == null) { return(null); } return(string.IsNullOrEmpty(member.Nickname) ? $"`{member.Username.Sanitize()}#{member.Discriminator}`" : $"`{member.Username.Sanitize()}#{member.Discriminator}` (shown as `{member.Nickname.Sanitize()}`)"); }
public MuteContext(DiscordGuild guild, DiscordMember moderator, DiscordMember member, DiscordChannel channel, string?reason) { Guild = guild; GuildId = guild.Id; Moderator = moderator; ModeratorId = moderator.Id; Member = member; MemberId = member.Id; SourceChannel = channel; Reason = reason; }
public async Task GetAvatarAsync(CommandContext ctx, [RemainingText] string user) { DiscordMember?userObj = ctx.Guild.Members.Values.FirstOrDefault(u => u.Username.Contains(user, StringComparison.OrdinalIgnoreCase)); if (userObj is null) { await ctx.RespondAsync("Sorry, I couldn't find anyone with a name matching the text provided."); } else { await ctx.RespondAsync( DefaultAvatarEmbed(ctx) .WithAuthor(ctx.User.Username, iconUrl : ctx.User.AvatarUrl) .WithDescription($"{userObj.Mention}'s Avatar") .WithImageUrl(AvatarImageResizedUrl(userObj.AvatarUrl))); } }
public void Update() { if (Guild == null) { Moderator = null; Member = null; return; } Moderator = Guild.Members.TryGetValue(ModeratorId, out var moderator) ? moderator : null; Member = Guild.Members.TryGetValue(MemberId, out var member) ? member : null; }
public async Task GetBalanceAsync(CommandContext ctx, [Description("desc-member")] DiscordMember?member = null) { member ??= ctx.Member; BankAccount?balance = await this.Service.GetAsync(ctx.Guild.Id, member.Id); await ctx.RespondWithLocalizedEmbedAsync(emb => { emb.WithColor(this.ModuleColor); emb.WithLocalizedTitle("fmt-bank-acc", Emojis.MoneyBag, member.ToDiscriminatorString()); emb.WithThumbnail(member.AvatarUrl); if (balance is { }) { string currency = ctx.Services.GetRequiredService <GuildConfigService>().GetCachedConfig(ctx.Guild.Id).Currency; CultureInfo culture = this.Localization.GetGuildCulture(ctx.Guild.Id); emb.WithLocalizedDescription("fmt-bank-acc-value", balance.Balance.ToWords(culture), currency); emb.AddLocalizedTitleField("str-bank-acc-value-num", $"{balance.Balance:n0} {currency}"); }
public async Task <int> GetDonorRankAsync(ulong ownerId) { if (this.HomeGuild is null) { foreach (DiscordClient?shard in this._client.ShardClients.Values) { if (shard.Guilds.TryGetValue(this._pcfg.HomeGuild, out this.HomeGuild)) { this.HomeGuild = await shard.GetGuildAsync(this._pcfg.HomeGuild); break; } } } if (this.HomeGuild is not null) { try { DiscordMember?m = await this.HomeGuild.GetMemberAsync(ownerId); int rank = 0; foreach (DiscordRole?role in m.Roles) { PartnerBotDonorRoleConfiguration?r; if ((r = this._pcfg.DonorRoles.FirstOrDefault(x => x.RoleId == role.Id)) is not null) { rank += r.Weight; } } return(rank); } catch (Exception ex) { this._rest.Logger.LogWarning(ex, $"Donor rank get failed for {ownerId}"); return(0); } } else { return(0); } }
public async Task BalanceCommandAsync(CommandContext ctx, DiscordMember?member = null) { bool save = false; DiscordMember m; if (member is null) { m = ctx.Member; } else { m = member; } var wallet = this._model.Wallets.Find(m.Id); if (wallet is null) { wallet = new Wallet(m.Id, ctx.User.Username); // Save the new wallet to the database. this._model.Wallets.Add(wallet); save = true; } else { if (wallet.Username != ctx.Member.Username) { wallet.Username = ctx.Member.Username; save = true; } } if (save) { _ = await this._model.SaveChangesAsync(); } var b = CommandModule.SuccessBase() .WithTitle($"{m.DisplayName}'s Balance") .WithDescription(Formatter.Bold(wallet.Balance.ToMoney())); await ctx.RespondAsync(embed : b.Build()); }
GetPrivateChannel(DiscordMessage message) { DiscordChannel channel = message.Channel; if (!channel.IsPrivate) { // if message was not from a DM channel, then we share a server: // a guild exists and casting to DiscordMember should work DiscordGuild guild = message.Channel.Guild; DiscordMember?member = message.Author.ToDiscordMember(guild); if (member == null) { log.Warning("Could not create a DM channel."); return(null); } channel = await member.CreateDmChannelAsync(); } return(channel); }
public static bool MemberNameMatches(DiscordMember?member, string name) { if (member == null) { return(false); } var displayName = member.DisplayName.ToLower(); var usrName = member.Username.ToLower(); if (name.Equals(displayName) || name.Equals(usrName)) { return(true); } if (!IsMention(name, out var id)) { return(false); } return(member.Id == id); }
public async Task GetPurchasedItemsAsync(CommandContext ctx, [Description("desc-member")] DiscordMember?member = null) { member ??= ctx.Member; IReadOnlyList <PurchasedItem> purchased = await this.Service.Purchases.GetAllCompleteAsync(member.Id); if (!purchased.Any()) { await ctx.FailAsync("cmd-err-shop-purchased-none", member.Mention); return; } await ctx.PaginateAsync( "fmt-shop-purchased", purchased.OrderBy(i => i.Item.Price), i => $"{Formatter.Bold(i.Item.Name)} | {i.Item.Price}", this.ModuleColor, 5, member.ToDiscriminatorString() ); }
public MuteContext(RiasBot riasBot, ulong guildId, ulong moderatorId, ulong memberId, ulong channelId) { Guild = riasBot.GetGuild(guildId); GuildId = guildId; MemberId = memberId; if (Guild != null) { if (Guild.Members.TryGetValue(moderatorId, out var moderator)) { Moderator = moderator; } if (Guild.Members.TryGetValue(memberId, out var member)) { Member = member; } SourceChannel = Guild.GetChannel(channelId); } SentByTimer = true; }
private async Task SendReactionAsync(string reaction, DiscordMember?member, string localeYou, string localeBy, bool isWeeb = true) { if (string.IsNullOrEmpty(Configuration.WeebServicesToken)) { await ReplyErrorAsync(Localization.ReactionsNoWeebApi); return; } var embed = new DiscordEmbedBuilder { Color = RiasUtilities.ConfirmColor, ImageUrl = isWeeb ? await Service.GetReactionAsync(reaction) : await Service.GetImageAsync(reaction), Footer = new DiscordEmbedBuilder.EmbedFooter { Text = $"{GetText(Localization.ReactionsPoweredBy)} {(isWeeb ? "weeb.sh" : "rias.gg")}" } }; if (member is null || member.Id == Context.User.Id) { await Context.Channel.SendMessageAsync(GetText(localeYou, Context.User.Mention), embed); }
public async Task GetAuditLogsAsync(CommandContext ctx, [Description("desc-auditlog-amount")] int amount = 10, [Description("desc-auditlog-mem")] DiscordMember?member = null) { if (amount is < 1 or > 50) { throw new InvalidCommandUsageException(ctx, "cmd-err-auditlog-amount", 50); } IReadOnlyList <DiscordAuditLogEntry> logs = await ctx.Guild.GetAuditLogsAsync(amount, member); await ctx.PaginateAsync( logs, (emb, e) => { emb.WithTitle(e.ActionType.ToString()); emb.WithDescription(e.Id.ToString()); emb.AddInvocationFields(e.UserResponsible); emb.AddReason(e.Reason); emb.WithLocalizedTimestamp(e.CreationTimestamp, e.UserResponsible.AvatarUrl); return(emb); }, this.ModuleColor ); }
public async Task <(bool, DiscordMember?)> IsCessumAdmin(BaseContext ctx) { if (DiscordBot.Client is null) { return(false, null); } DiscordMember?staffMember = null; try { foreach (DiscordClient?c in DiscordBot.Client.ShardClients.Values) { if (c.Guilds.TryGetValue(this._pcfg.HomeGuild, out DiscordGuild? g)) { staffMember = await g.GetMemberAsync(ctx.Member.Id); } } } catch { return(false, null); } if (staffMember == null) { return(false, null); } if (staffMember.Roles.Any(r => r.Permissions.HasPermission(Permissions.Administrator))) { return(true, staffMember); } return(false, staffMember); }
public Task InfoAsync(CommandContext ctx, [Description("desc-member")] DiscordMember?member = null) { member ??= ctx.Member; return(ctx.RespondWithLocalizedEmbedAsync(emb => { emb.WithTitle(member.ToDiscriminatorString()); emb.WithThumbnail(member.AvatarUrl); emb.WithColor(this.ModuleColor); emb.AddLocalizedTimestampField("str-regtime", member.CreationTimestamp, inline: true); emb.AddLocalizedTimestampField("str-joined-at", member.JoinedAt, inline: true); emb.AddLocalizedTitleField("str-id", member.Id, inline: true); emb.AddLocalizedTitleField("str-hierarchy", member.Hierarchy, inline: true); emb.AddLocalizedTitleField("str-status", ToPresenceString(member.Presence), inline: true); emb.AddLocalizedTitleField("str-ahash", member.AvatarHash, inline: true, unknown: false); emb.AddLocalizedTitleField("str-verified", member.Verified, inline: true, unknown: false); emb.AddLocalizedTitleField("str-flags", member.Flags?.Humanize(), inline: true, unknown: false); emb.AddLocalizedTitleField("str-locale", member.Locale, inline: true, unknown: false); emb.AddLocalizedTitleField("str-mfa", member.MfaEnabled, inline: true, unknown: false); emb.AddLocalizedTitleField("str-flags-oauth", member.OAuthFlags?.Humanize(), inline: true, unknown: false); emb.AddLocalizedTitleField("str-premium-type", member.PremiumType?.Humanize(), inline: true, unknown: false); emb.AddLocalizedTimestampField("str-premium-since", member.PremiumSince, inline: true); emb.AddLocalizedTitleField("str-email", member.Email, inline: true, unknown: false); emb.AddLocalizedTitleField("str-activity", member.Presence?.Activity?.ToDetailedString(), inline: true, unknown: false); if (member.Roles.Any()) { emb.AddLocalizedTitleField("str-roles", member.Roles.Select(r => r.Mention).JoinWith(", ")); } })); string ToPresenceString(DiscordPresence?presence) { return(presence is { } ? $"{presence.Status} ({presence.ClientStatus.ToUserFriendlyString()})" : this.Localization.GetString(ctx.Guild.Id, "str-offline")); }
public Task StatsAsync(CommandContext ctx, [Description("desc-member")] DiscordMember?member = null) => this.StatsAsync(ctx, member as DiscordUser);
public Task ExecuteGroupAsync(CommandContext ctx, [Description("desc-member")] DiscordMember?member = null) => this.ExecuteGroupAsync(ctx, member as DiscordUser);
private static DiscordEmbedBuilder MakeReportTemplate(DiscordClient client, string infraction, DiscordMessage message, ReportSeverity severity, string?actionList = null) { var content = message.Content; if (message.Channel.IsPrivate) { severity = ReportSeverity.None; } var needsAttention = severity > ReportSeverity.Low; if (message.Embeds?.Any() ?? false) { if (!string.IsNullOrEmpty(content)) { content += Environment.NewLine; } var srcEmbed = message.Embeds.First(); content += $"🔤 {srcEmbed.Title}"; if (srcEmbed.Fields?.Any() ?? false) { content += $"{Environment.NewLine}{srcEmbed.Description}{Environment.NewLine}+{srcEmbed.Fields.Count} fields"; } } if (message.Attachments?.Any() ?? false) { if (!string.IsNullOrEmpty(content)) { content += Environment.NewLine; } content += string.Join(Environment.NewLine, message.Attachments.Select(a => "📎 " + a.FileName)); } if (string.IsNullOrEmpty(content)) { content = "🤔 something fishy is going on here, there was no message or attachment"; } DiscordMember?author = null; try { author = client.GetMember(message.Author); } catch (Exception e) { Config.Log.Warn(e, $"Failed to get the member info for user {message.Author.Id} ({message.Author.Username})"); } var result = new DiscordEmbedBuilder { Title = infraction, Color = GetColor(severity), }.AddField("Violator", author is null ? message.Author.Mention : GetMentionWithNickname(author), true) .AddField("Channel", message.Channel.IsPrivate ? "Bot's DM" : message.Channel.Mention, true) //.AddField("Time (UTC)", message.CreationTimestamp.ToString("yyyy-MM-dd HH:mm:ss"), true) .AddField("Content of the offending item", content.Trim(EmbedPager.MaxFieldLength)); if (!string.IsNullOrEmpty(actionList)) { result.AddField("Filter Actions", actionList, true); } if (needsAttention && !message.Channel.IsPrivate) { result.AddField("Link to the message", message.JumpLink.ToString()); } #if DEBUG result.WithFooter("Test bot instance"); #endif return(result); }
private async Task <Tuple <DiscordMember?, string> > PlayReversiRound(CommandContext ctx, DiscordMember player1, DiscordMember player2, bool keepMsgs) { ReversiBoard b = new ReversiBoard(); b.SetForNewGame(); bool currentPlayerIs1 = true; while (true) { currentPlayerIs1 = !currentPlayerIs1; ReversiBoard.Color player = currentPlayerIs1 ? ReversiBoard.Color.White : ReversiBoard.Color.Black; string renderedBoard = ""; renderedBoard += "```\n A B C D E F G H\n ┌─┬─┬─┬─┬─┬─┬─┬─┐"; for (int y = 0; y < 8; y++) { if (y != 0) { renderedBoard += "\n ├─┼─┼─┼─┼─┼─┼─┼─┤"; } renderedBoard += $"\n{y + 1}│"; for (int x = 0; x < 8; x++) { renderedBoard += b.GetSquareContents(y, x) switch { ReversiBoard.Color.Black => "O", ReversiBoard.Color.Empty => b.IsValidMove(player, y, x) ? "-" : " ", ReversiBoard.Color.White => "X", _ => throw new ArgumentOutOfRangeException() } } +"│"; } renderedBoard += "\n └─┴─┴─┴─┴─┴─┴─┴─┘\n```"; if (!b.HasAnyValidMove(player)) { if (!b.HasAnyValidMove(ReversiBoard.Invert(player))) { await ctx.RespondAsync(embed : new DiscordEmbedBuilder { Title = "Reversi", Description = b.WhiteCount == b.BlackCount ? "Tie!" : $"{(b.WhiteCount > b.BlackCount ? player1.DisplayName : player2.DisplayName)} won" }.AddField("Board", renderedBoard).Build()); DiscordMember?winner = b.WhiteCount == b.BlackCount ? null : b.WhiteCount > b.BlackCount ? player1 : player2; return(new Tuple <DiscordMember?, string>(winner, renderedBoard)); } continue; } DiscordMessage board = await ctx.RespondAsync(embed : new DiscordEmbedBuilder { Title = "Reversi", Description = $"Current turn: {(currentPlayerIs1 ? player1.DisplayName : player2.DisplayName)}" }.AddField("Board", renderedBoard).AddField("Tutorial", "Just respond with your column and row within one minute when it is your turn\n(eg: \"A5\")") .Build()); bool reading = true; DateTime trg = DateTime.Now + new TimeSpan(0, 1, 0); while (reading) { InteractivityResult <DiscordMessage> response = await ctx.Channel.GetNextMessageAsync(currentPlayerIs1?player1 : player2, trg - DateTime.Now); if (response.TimedOut) { await ctx.RespondAsync("Timed out."); return(null); } int[] text = response.Result.Content.ToLower().Select(s => (int)s).ToArray(); if (text.Length != 2 || text[0] < 97 || text[0] > 104 || text[1] < 49 || text[1] > 56) { await ctx.RespondAsync("Invalid."); } else { int x = text[0] - 97; int y = text[1] - 49; if (b.IsValidMove(player, y, x)) { if (!keepMsgs) { board.DeleteAsync(); } b.MakeMove(player, y, x); reading = false; } else { await ctx.RespondAsync("Invalid move."); } } } } }
public Task HandholdingAsync([Remainder] DiscordMember?member = null) => SendReactionAsync("handholding", member, Localization.ReactionsHandholding, Localization.ReactionsHandholdingMember);