diff --git a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs index 7e84b2e3..56892853 100644 --- a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -73,7 +73,7 @@ namespace NadekoBot.Modules.CustomReactions if ((channel == null && !NadekoBot.Credentials.IsOwner(imsg.Author)) || (channel != null && !((IGuildUser)imsg.Author).GuildPermissions.Administrator)) { - try { await channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } + try { await imsg.Channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } return; } @@ -102,7 +102,7 @@ namespace NadekoBot.Modules.CustomReactions reactions.Add(cr); } - await channel.SendMessageAsync($"`Added new custom reaction:`\n\t`Trigger:` {key}\n\t`Response:` {message}").ConfigureAwait(false); + await imsg.Channel.SendMessageAsync($"`Added new custom reaction:`\n\t`Trigger:` {key}\n\t`Response:` {message}").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -132,7 +132,7 @@ namespace NadekoBot.Modules.CustomReactions if ((channel == null && !NadekoBot.Credentials.IsOwner(imsg.Author)) || (channel != null && !((IGuildUser)imsg.Author).GuildPermissions.Administrator)) { - try { await channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } + try { await imsg.Channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } return; } @@ -147,11 +147,13 @@ namespace NadekoBot.Modules.CustomReactions if (toDelete.GuildId == null && channel == null) { uow.CustomReactions.Remove(toDelete); + success = true; } - else if (toDelete.GuildId != null && channel.Guild.Id == toDelete.GuildId) + else if (toDelete.GuildId != null && channel?.Guild.Id == toDelete.GuildId) { uow.CustomReactions.Remove(toDelete); + GuildReactions.GetOrAdd(channel.Guild.Id, new HashSet()).RemoveWhere(cr => cr.Id == toDelete.Id); success = true; } if(success) @@ -159,9 +161,9 @@ namespace NadekoBot.Modules.CustomReactions } if (success) - await channel.SendMessageAsync("**Successfully deleted custom reaction** " + toDelete.ToString()).ConfigureAwait(false); + await imsg.Channel.SendMessageAsync("**Successfully deleted custom reaction** " + toDelete.ToString()).ConfigureAwait(false); else - await channel.SendMessageAsync("Failed to find that custom reaction.").ConfigureAwait(false); + await imsg.Channel.SendMessageAsync("`Failed to find that custom reaction.`").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Services/IBotCredentials.cs b/src/NadekoBot/Services/IBotCredentials.cs index 385b0e27..64b5f7d7 100644 --- a/src/NadekoBot/Services/IBotCredentials.cs +++ b/src/NadekoBot/Services/IBotCredentials.cs @@ -6,7 +6,9 @@ namespace NadekoBot.Services { public interface IBotCredentials { - string ClientId { get; } + ulong ClientId { get; } + ulong BotId { get; } + string Token { get; } string GoogleApiKey { get; } ulong[] OwnerIds { get; } diff --git a/src/NadekoBot/Services/Impl/BotCredentials.cs b/src/NadekoBot/Services/Impl/BotCredentials.cs index 5a540c5b..9343efd9 100644 --- a/src/NadekoBot/Services/Impl/BotCredentials.cs +++ b/src/NadekoBot/Services/Impl/BotCredentials.cs @@ -12,7 +12,8 @@ namespace NadekoBot.Services.Impl { private Logger _log; - public string ClientId { get; } + public ulong ClientId { get; } + public ulong BotId { get; } public string GoogleApiKey { get; } @@ -42,7 +43,8 @@ namespace NadekoBot.Services.Impl MashapeKey = cm.MashapeKey; OsuApiKey = cm.OsuApiKey; TotalShards = cm.TotalShards < 1 ? 1 : cm.TotalShards; - SoundCloudClientId = cm.SoundCloudClientId; + BotId = cm.BotId ?? cm.ClientId; + ClientId = cm.ClientId; if (cm.Db == null) Db = new DB("sqlite", ""); else @@ -58,6 +60,8 @@ namespace NadekoBot.Services.Impl private class CredentialsModel { + public ulong ClientId { get; set; } + public ulong? BotId { get; set; } public string Token { get; set; } public ulong[] OwnerIds { get; set; } public string LoLApiKey { get; set; }