diff --git a/SysBot.Pokemon.Discord/Commands/CloneModule.cs b/SysBot.Pokemon.Discord/Commands/CloneModule.cs index 81e8f6c80..54bb5349d 100644 --- a/SysBot.Pokemon.Discord/Commands/CloneModule.cs +++ b/SysBot.Pokemon.Discord/Commands/CloneModule.cs @@ -18,8 +18,15 @@ public class CloneModule : ModuleBase public async Task CloneAsync(int code) { var cfg = Info.Hub.Config; - var sudo = Context.GetHasRole(cfg.DiscordRoleSudo); + var sudo = Context.GetIsSudo(cfg); var allowed = sudo || (Context.GetHasRole(cfg.DiscordRoleCanClone) && Info.CanQueue); + + if (!sudo && !Info.CanQueue) + { + await ReplyAsync("Sorry, I am not currently accepting queue requests!").ConfigureAwait(false); + return; + } + if (!allowed) { await ReplyAsync("Sorry, you are not permitted to use this command!").ConfigureAwait(false); @@ -35,6 +42,7 @@ public async Task CloneAsync(int code) } [Command("clone")] + [Alias("c")] [Summary("Clones the Pokemon you show via Link Trade.")] public async Task CloneAsync() { diff --git a/SysBot.Pokemon.Discord/Commands/DuduModule.cs b/SysBot.Pokemon.Discord/Commands/DuduModule.cs index d3c0a0c0d..8b5f010a5 100644 --- a/SysBot.Pokemon.Discord/Commands/DuduModule.cs +++ b/SysBot.Pokemon.Discord/Commands/DuduModule.cs @@ -18,8 +18,15 @@ public class DuduModule : ModuleBase public async Task SeedCheckAsync(int code) { var cfg = Info.Hub.Config; - var sudo = Context.GetHasRole(cfg.DiscordRoleSudo); + var sudo = Context.GetIsSudo(cfg); var allowed = sudo || (Context.GetHasRole(cfg.DiscordRoleCanDudu) && Info.CanQueue); + + if (!sudo && !Info.CanQueue) + { + await ReplyAsync("Sorry, I am not currently accepting queue requests!").ConfigureAwait(false); + return; + } + if (!allowed) { await ReplyAsync("Sorry, you are not permitted to use this command!").ConfigureAwait(false); @@ -122,4 +129,4 @@ private bool AddToTradeQueue(PK8 pk8, int code, string trainerName, bool sudo, P return true; } } -} \ No newline at end of file +} diff --git a/SysBot.Pokemon.Discord/Commands/TradeModule.cs b/SysBot.Pokemon.Discord/Commands/TradeModule.cs index 0c6f9b4af..1d6fcbf6a 100644 --- a/SysBot.Pokemon.Discord/Commands/TradeModule.cs +++ b/SysBot.Pokemon.Discord/Commands/TradeModule.cs @@ -43,6 +43,13 @@ public async Task TradeAsync([Summary("Trade Code")]int code, [Remainder][Summar var cfg = Info.Hub.Config; var sudo = Context.GetIsSudo(cfg); var allowed = sudo || (Context.GetHasRole(cfg.DiscordRoleCanTrade) && Info.CanQueue); + + if (!sudo && !Info.CanQueue) + { + await ReplyAsync("Sorry, I am not currently accepting queue requests!").ConfigureAwait(false); + return; + } + if (!allowed) { await ReplyAsync("Sorry, you are not permitted to use this command!").ConfigureAwait(false); @@ -80,6 +87,13 @@ public async Task TradeAsync([Summary("Showdown Set")][Remainder]string content) var cfg = Info.Hub.Config; var sudo = Context.GetIsSudo(cfg); var allowed = sudo || (Context.GetHasRole(cfg.DiscordRoleCanTrade) && Info.CanQueue); + + if (!sudo && !Info.CanQueue) + { + await ReplyAsync("Sorry, I am not currently accepting queue requests!").ConfigureAwait(false); + return; + } + if (!allowed) { await ReplyAsync("Sorry, you are not permitted to use this command!").ConfigureAwait(false); @@ -157,4 +171,4 @@ private bool AddToTradeQueue(PK8 pk8, int code, string trainerName, bool sudo, P return true; } } -} \ No newline at end of file +} diff --git a/SysBot.Pokemon.Discord/Helpers/DiscordTradeNotifier.cs b/SysBot.Pokemon.Discord/Helpers/DiscordTradeNotifier.cs index 1f7d7739a..3a75a62e5 100644 --- a/SysBot.Pokemon.Discord/Helpers/DiscordTradeNotifier.cs +++ b/SysBot.Pokemon.Discord/Helpers/DiscordTradeNotifier.cs @@ -30,7 +30,7 @@ public void TradeInitialize(PokeRoutineExecutor routine, PokeTradeDetail info public void TradeSearching(PokeRoutineExecutor routine, PokeTradeDetail info) { var name = Info.TrainerName; - var trainer = string.IsNullOrEmpty(name) ? string.Empty : $", ({name})"; + var trainer = string.IsNullOrEmpty(name) ? string.Empty : $", {name}"; Context.User.SendMessageAsync($"I'm searching for you{trainer}! Your code is {Code:0000}.").ConfigureAwait(false); } diff --git a/SysBot.Pokemon.Twitch/Helpers/TwitchTradeNotifier.cs b/SysBot.Pokemon.Twitch/Helpers/TwitchTradeNotifier.cs index 9790882fd..e04f662d1 100644 --- a/SysBot.Pokemon.Twitch/Helpers/TwitchTradeNotifier.cs +++ b/SysBot.Pokemon.Twitch/Helpers/TwitchTradeNotifier.cs @@ -54,7 +54,7 @@ public void TradeInitialize(PokeRoutineExecutor routine, PokeTradeDetail info public void TradeSearching(PokeRoutineExecutor routine, PokeTradeDetail info) { var name = Info.TrainerName; - var trainer = string.IsNullOrEmpty(name) ? string.Empty : $", ({name})"; + var trainer = string.IsNullOrEmpty(name) ? string.Empty : $", {name}"; Client.SendWhisper(Username, $"I'm searching for you{trainer}! Use the code you whispered me to search!"); } } diff --git a/SysBot.Pokemon/Actions/PokeRoutineExecutor.cs b/SysBot.Pokemon/Actions/PokeRoutineExecutor.cs index a2a951936..1aab8ca40 100644 --- a/SysBot.Pokemon/Actions/PokeRoutineExecutor.cs +++ b/SysBot.Pokemon/Actions/PokeRoutineExecutor.cs @@ -127,12 +127,12 @@ protected async Task EnterTradeCode(int code, CancellationToken token) // Confirm Code outside of this method (allow synchronization) } - public async Task EnsureConnectedToYCom(CancellationToken token) + public async Task EnsureConnectedToYComm(CancellationToken token) { - if (!await IsGameConnectedToYCom(token).ConfigureAwait(false)) + if (!await IsGameConnectedToYComm(token).ConfigureAwait(false)) { - Connection.Log("Reconnecting to Y-Com..."); - await ReconnectToYCom(token).ConfigureAwait(false); + Connection.Log("Reconnecting to Y-Comm..."); + await ReconnectToYComm(token).ConfigureAwait(false); } } @@ -149,14 +149,14 @@ public async Task GetTradePartnerName(TradeMethod tradeMethod, Cancellat return StringConverter.GetString7(data, 0, 26); } - public async Task IsGameConnectedToYCom(CancellationToken token) + public async Task IsGameConnectedToYComm(CancellationToken token) { - // Reads the Y-Com Flag is the Game is connected Online + // Reads the Y-Comm Flag is the Game is connected Online var data = await Connection.ReadBytesAsync(IsConnectedOffset, 1, token).ConfigureAwait(false); return data[0] == 1; } - public async Task ReconnectToYCom(CancellationToken token) + public async Task ReconnectToYComm(CancellationToken token) { // Press B in case a Error Message is Present await Click(B, 2000, token).ConfigureAwait(false); diff --git a/SysBot.Pokemon/BotTrade/PokeTradeBot.cs b/SysBot.Pokemon/BotTrade/PokeTradeBot.cs index 98faa9407..7f69234ce 100644 --- a/SysBot.Pokemon/BotTrade/PokeTradeBot.cs +++ b/SysBot.Pokemon/BotTrade/PokeTradeBot.cs @@ -93,7 +93,7 @@ private async Task DoTrades(SAV8SWSH sav, CancellationToken token) waitCounter = 0; Connection.Log($"Starting next {type} Bot Trade. Getting data..."); - await EnsureConnectedToYCom(token).ConfigureAwait(false); + await EnsureConnectedToYComm(token).ConfigureAwait(false); var result = await PerformLinkCodeTrade(sav, detail, token).ConfigureAwait(false); if (result != PokeTradeResult.Success) // requeue { @@ -118,7 +118,7 @@ private async Task DoSurpriseTrades(SAV8SWSH sav, CancellationToken token) while (!token.IsCancellationRequested && Config.NextRoutineType == PokeRoutineType.SurpriseTrade) { var pkm = Hub.Ledy.Pool.GetRandomSurprise(); - await EnsureConnectedToYCom(token).ConfigureAwait(false); + await EnsureConnectedToYComm(token).ConfigureAwait(false); var _ = await PerformSurpriseTrade(sav, pkm, token).ConfigureAwait(false); } } @@ -477,6 +477,7 @@ private void ReplyWithZ3Results(PokeTradeDetail detail, PK8 result) var msg = match.ToString(); detail.SendNotification(this, msg); } + Connection.Log("Seed calculation completed."); } private void WaitAtBarrierIfApplicable(CancellationToken token)