diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index bff563a3..e60bd425 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -124,7 +124,7 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } - await channel.SendMessageAsync($"{imsg.Author.Mention} πŸ†— **Permissions for this server are reset.**"); + await channel.SendConfirmAsync($"{imsg.Author.Mention} πŸ†— **Permissions for this server are reset.**"); } [NadekoCommand, Usage, Description, Aliases] @@ -142,9 +142,9 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } if (enabled) - await channel.SendMessageAsync("βœ… **Now automatically deleting successful command invokations.**").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… **Now automatically deleting successful command invokations.**").ConfigureAwait(false); else - await channel.SendMessageAsync("❗**Stopped automatic deletion of successful command invokations.**").ConfigureAwait(false); + await channel.SendConfirmAsync("❗**Stopped automatic deletion of successful command invokations.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -156,11 +156,11 @@ namespace NadekoBot.Modules.Administration try { await usr.AddRolesAsync(role).ConfigureAwait(false); - await channel.SendMessageAsync($"ℹ️ Successfully added role **{role.Name}** to user **{usr.Username}**").ConfigureAwait(false); + await channel.SendConfirmAsync($"ℹ️ Successfully added role **{role.Name}** to user **{usr.Username}**").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync("⚠️ Failed to add role. **Bot has insufficient permissions.**\n").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Failed to add role. **Bot has insufficient permissions.**\n").ConfigureAwait(false); Console.WriteLine(ex.ToString()); } } @@ -174,11 +174,11 @@ namespace NadekoBot.Modules.Administration try { await usr.RemoveRolesAsync(role).ConfigureAwait(false); - await channel.SendMessageAsync($"ℹ️ Successfully removed role **{role.Name}** from user **{usr.Username}**").ConfigureAwait(false); + await channel.SendConfirmAsync($"ℹ️ Successfully removed role **{role.Name}** from user **{usr.Username}**").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ Failed to remove role. Most likely reason: **Insufficient permissions.**").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Failed to remove role. Most likely reason: **Insufficient permissions.**").ConfigureAwait(false); } } @@ -192,15 +192,15 @@ namespace NadekoBot.Modules.Administration { if (roleToEdit.Position > (await channel.Guild.GetCurrentUserAsync().ConfigureAwait(false)).Roles.Max(r => r.Position)) { - await channel.SendMessageAsync("🚫 You can't edit roles higher than your highest role.").ConfigureAwait(false); + await channel.SendErrorAsync("🚫 You can't edit roles higher than your highest role.").ConfigureAwait(false); return; } await roleToEdit.ModifyAsync(g => g.Name = newname).ConfigureAwait(false); - await channel.SendMessageAsync("βœ… Role renamed.").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… Role renamed.").ConfigureAwait(false); } catch (Exception) { - await channel.SendMessageAsync("⚠️ Failed to rename role. Probably **insufficient permissions.**").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Failed to rename role. Probably **insufficient permissions.**").ConfigureAwait(false); } } @@ -214,11 +214,11 @@ namespace NadekoBot.Modules.Administration try { await user.RemoveRolesAsync(user.Roles).ConfigureAwait(false); - await channel.SendMessageAsync($"πŸ—‘ Successfully removed **all** roles from user **{user.Username}**").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ—‘ Successfully removed **all** roles from user **{user.Username}**").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ Failed to remove roles. Most likely reason: **Insufficient permissions.**").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Failed to remove roles. Most likely reason: **Insufficient permissions.**").ConfigureAwait(false); } } @@ -235,11 +235,11 @@ namespace NadekoBot.Modules.Administration try { var r = await channel.Guild.CreateRoleAsync(roleName).ConfigureAwait(false); - await channel.SendMessageAsync($"βœ… Successfully created role **{r.Name}**.").ConfigureAwait(false); + await channel.SendConfirmAsync($"βœ… Successfully created role **{r.Name}**.").ConfigureAwait(false); } catch (Exception) { - await channel.SendMessageAsync("⚠️ Unspecified error.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Unspecified error.").ConfigureAwait(false); } } @@ -252,7 +252,7 @@ namespace NadekoBot.Modules.Administration if (args.Count() != 2 && args.Count() != 4) { - await channel.SendMessageAsync("❌ The parameters specified are **invalid.**").ConfigureAwait(false); + await channel.SendErrorAsync("❌ The parameters specified are **invalid.**").ConfigureAwait(false); return; } var roleName = args[0].ToUpperInvariant(); @@ -260,7 +260,7 @@ namespace NadekoBot.Modules.Administration if (role == null) { - await channel.SendMessageAsync("🚫 That role **does not exist.**").ConfigureAwait(false); + await channel.SendErrorAsync("🚫 That role **does not exist.**").ConfigureAwait(false); return; } try @@ -273,11 +273,11 @@ namespace NadekoBot.Modules.Administration var blue = Convert.ToByte(rgb ? int.Parse(args[3]) : Convert.ToInt32(arg1.Substring(4, 2), 16)); await role.ModifyAsync(r => r.Color = new Discord.Color(red, green, blue).RawValue).ConfigureAwait(false); - await channel.SendMessageAsync($"β˜‘οΈ Role **{role.Name}'s** color has been changed.").ConfigureAwait(false); + await channel.SendConfirmAsync($"β˜‘οΈ Role **{role.Name}'s** color has been changed.").ConfigureAwait(false); } catch (Exception) { - await channel.SendMessageAsync("⚠️ Error occured, most likely **invalid parameters** or **insufficient permissions.**").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Error occured, most likely **invalid parameters** or **insufficient permissions.**").ConfigureAwait(false); } } @@ -293,12 +293,12 @@ namespace NadekoBot.Modules.Administration } if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r=>r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max()) { - await channel.SendMessageAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); + await channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); return; } try { - await (await user.CreateDMChannelAsync()).SendMessageAsync($"⛔️ **You have been BANNED from `{channel.Guild.Name}` server.**\n" + + await (await user.CreateDMChannelAsync()).SendErrorAsync($"⛔️ **You have been BANNED from `{channel.Guild.Name}` server.**\n" + $"βš– *Reason:* {msg}").ConfigureAwait(false); await Task.Delay(2000).ConfigureAwait(false); } @@ -307,11 +307,11 @@ namespace NadekoBot.Modules.Administration { await channel.Guild.AddBanAsync(user, 7).ConfigureAwait(false); - await channel.SendMessageAsync("⛔️ **Banned** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); + await channel.SendConfirmAsync("⛔️ **Banned** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ **Error.** Most likely I don't have sufficient permissions.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ **Error.** Most likely I don't have sufficient permissions.").ConfigureAwait(false); } } @@ -328,12 +328,12 @@ namespace NadekoBot.Modules.Administration } if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r => r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max()) { - await channel.SendMessageAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); + await channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); return; } try { - await user.SendMessageAsync($"☣ **You have been SOFT-BANNED from `{channel.Guild.Name}` server.**\n" + + await user.SendErrorAsync($"☣ **You have been SOFT-BANNED from `{channel.Guild.Name}` server.**\n" + $"βš– *Reason:* {msg}").ConfigureAwait(false); await Task.Delay(2000).ConfigureAwait(false); } @@ -344,11 +344,11 @@ namespace NadekoBot.Modules.Administration try { await channel.Guild.RemoveBanAsync(user).ConfigureAwait(false); } catch { await channel.Guild.RemoveBanAsync(user).ConfigureAwait(false); } - await channel.SendMessageAsync("☣ **Soft-Banned** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); + await channel.SendConfirmAsync("☣ **Soft-Banned** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); } } @@ -361,20 +361,20 @@ namespace NadekoBot.Modules.Administration if (user == null) { - await channel.SendMessageAsync("❗️User not found.").ConfigureAwait(false); + await channel.SendErrorAsync("❗️User not found.").ConfigureAwait(false); return; } if (umsg.Author.Id != user.Guild.OwnerId && user.Roles.Select(r => r.Position).Max() >= ((IGuildUser)umsg.Author).Roles.Select(r => r.Position).Max()) { - await channel.SendMessageAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); + await channel.SendErrorAsync("⚠️ You can't use this command on users with a role higher or equal to yours in the role hierarchy."); return; } if (!string.IsNullOrWhiteSpace(msg)) { try { - await user.SendMessageAsync($"‼️**You have been KICKED from `{channel.Guild.Name}` server.**\n" + + await user.SendErrorAsync($"‼️**You have been KICKED from `{channel.Guild.Name}` server.**\n" + $"βš– *Reason:* {msg}").ConfigureAwait(false); await Task.Delay(2000).ConfigureAwait(false); } @@ -383,11 +383,11 @@ namespace NadekoBot.Modules.Administration try { await user.KickAsync().ConfigureAwait(false); - await channel.SendMessageAsync("‼️**Kicked** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); + await channel.SendConfirmAsync("‼️**Kicked** user **" + user.Username + "** ID: `" + user.Id + "`").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Error. Most likely I don't have sufficient permissions.").ConfigureAwait(false); } } @@ -409,7 +409,7 @@ namespace NadekoBot.Modules.Administration GuildMuteRoles.AddOrUpdate(channel.Guild.Id, name, (id, old) => name); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync("β˜‘οΈ **New mute role set.**").ConfigureAwait(false); + await channel.SendConfirmAsync("β˜‘οΈ **New mute role set.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -431,11 +431,11 @@ namespace NadekoBot.Modules.Administration { await user.ModifyAsync(usr => usr.Mute = true).ConfigureAwait(false); await user.AddRolesAsync(await GetMuteRole(channel.Guild).ConfigureAwait(false)).ConfigureAwait(false); - await channel.SendMessageAsync($"πŸ”‡ **{user}** has been **muted** from text and voice chat successfully.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ”‡ **{user}** has been **muted** from text and voice chat successfully.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -451,11 +451,11 @@ namespace NadekoBot.Modules.Administration { await user.ModifyAsync(usr => usr.Mute = false).ConfigureAwait(false); await user.RemoveRolesAsync(await GetMuteRole(channel.Guild).ConfigureAwait(false)).ConfigureAwait(false); - await channel.SendMessageAsync($"πŸ”‰ **{user}** has been **unmuted** from text and voice chat successfully.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ”‰ **{user}** has been **unmuted** from text and voice chat successfully.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -469,11 +469,11 @@ namespace NadekoBot.Modules.Administration try { await user.AddRolesAsync(await GetMuteRole(channel.Guild).ConfigureAwait(false)).ConfigureAwait(false); - await channel.SendMessageAsync($"✏️🚫 **{user}** has been **muted** from chatting successfully.").ConfigureAwait(false); + await channel.SendConfirmAsync($"✏️🚫 **{user}** has been **muted** from chatting successfully.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -487,11 +487,11 @@ namespace NadekoBot.Modules.Administration try { await user.RemoveRolesAsync(await GetMuteRole(channel.Guild).ConfigureAwait(false)).ConfigureAwait(false); - await channel.SendMessageAsync($"βœοΈβœ… **{user}** has been **unmuted** from chatting successfully.").ConfigureAwait(false); + await channel.SendConfirmAsync($"βœοΈβœ… **{user}** has been **unmuted** from chatting successfully.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -505,11 +505,11 @@ namespace NadekoBot.Modules.Administration try { await user.ModifyAsync(usr => usr.Mute = true).ConfigureAwait(false); - await channel.SendMessageAsync($"πŸŽ™πŸš« **{user}** has been **voice muted** successfully.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸŽ™πŸš« **{user}** has been **voice muted** successfully.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -522,11 +522,11 @@ namespace NadekoBot.Modules.Administration try { await user.ModifyAsync(usr => usr.Mute = false).ConfigureAwait(false); - await channel.SendMessageAsync($"πŸŽ™βœ… **{user}** has been **voice unmuted** successfully.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸŽ™βœ… **{user}** has been **voice unmuted** successfully.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -545,11 +545,11 @@ namespace NadekoBot.Modules.Administration { await u.ModifyAsync(usr=>usr.Deaf = true).ConfigureAwait(false); } - await channel.SendMessageAsync("πŸ”‡ **Deafen** successful.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ”‡ **Deafen** successful.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -568,11 +568,11 @@ namespace NadekoBot.Modules.Administration { await u.ModifyAsync(usr=> usr.Deaf = false).ConfigureAwait(false); } - await channel.SendMessageAsync("πŸ”Š **Undeafen** successful.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ”Š **Undeafen** successful.").ConfigureAwait(false); } catch { - await channel.SendMessageAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ I most likely don't have the permission necessary for that.").ConfigureAwait(false); } } @@ -582,7 +582,7 @@ namespace NadekoBot.Modules.Administration public async Task DelVoiChanl(IUserMessage umsg, [Remainder] IVoiceChannel voiceChannel) { await voiceChannel.DeleteAsync().ConfigureAwait(false); - await umsg.Channel.SendMessageAsync($"πŸ—‘ Removed voice channel **{voiceChannel.Name}** successfully.").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync($"πŸ—‘ Removed voice channel **{voiceChannel.Name}** successfully.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -592,7 +592,7 @@ namespace NadekoBot.Modules.Administration { var channel = (ITextChannel)umsg.Channel; var ch = await channel.Guild.CreateVoiceChannelAsync(channelName).ConfigureAwait(false); - await channel.SendMessageAsync($"βœ… Created voice channel **{ch.Name}**. ID: `{ch.Id}`").ConfigureAwait(false); + await channel.SendConfirmAsync($"βœ… Created voice channel **{ch.Name}**. ID: `{ch.Id}`").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -601,7 +601,7 @@ namespace NadekoBot.Modules.Administration public async Task DelTxtChanl(IUserMessage umsg, [Remainder] ITextChannel toDelete) { await toDelete.DeleteAsync().ConfigureAwait(false); - await umsg.Channel.SendMessageAsync($"πŸ—‘ Removed text channel **{toDelete.Name}**. ID: `{toDelete.Id}`").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync($"πŸ—‘ Removed text channel **{toDelete.Name}**. ID: `{toDelete.Id}`").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -611,7 +611,7 @@ namespace NadekoBot.Modules.Administration { var channel = (ITextChannel)umsg.Channel; var txtCh = await channel.Guild.CreateTextChannelAsync(channelName).ConfigureAwait(false); - await channel.SendMessageAsync($"βœ… Added text channel **{txtCh.Name}**. ID: `{txtCh.Id}`").ConfigureAwait(false); + await channel.SendConfirmAsync($"βœ… Added text channel **{txtCh.Name}**. ID: `{txtCh.Id}`").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -622,7 +622,7 @@ namespace NadekoBot.Modules.Administration var channel = (ITextChannel)umsg.Channel; topic = topic ?? ""; await channel.ModifyAsync(c => c.Topic = topic); - await channel.SendMessageAsync("πŸ†— **New channel topic set.**").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— **New channel topic set.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -633,7 +633,7 @@ namespace NadekoBot.Modules.Administration var channel = (ITextChannel)umsg.Channel; await channel.ModifyAsync(c => c.Name = name).ConfigureAwait(false); - await channel.SendMessageAsync("πŸ†— **New channel name set.**").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— **New channel name set.**").ConfigureAwait(false); } @@ -680,7 +680,7 @@ namespace NadekoBot.Modules.Administration [OwnerOnly] public async Task Die(IUserMessage umsg) { - try { await umsg.Channel.SendMessageAsync("ℹ️ **Shutting down.**").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } + try { await umsg.Channel.SendConfirmAsync("ℹ️ **Shutting down.**").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } await Task.Delay(2000).ConfigureAwait(false); Environment.Exit(0); } @@ -694,7 +694,7 @@ namespace NadekoBot.Modules.Administration await (await NadekoBot.Client.GetCurrentUserAsync()).ModifyAsync(u => u.Username = newName).ConfigureAwait(false); - await umsg.Channel.SendMessageAsync($"ℹ️ Successfully changed name to **{newName}**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync($"ℹ️ Successfully changed name to **{newName}**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -716,7 +716,7 @@ namespace NadekoBot.Modules.Administration } } - await umsg.Channel.SendMessageAsync("πŸ†’ **New avatar set.**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("πŸ†’ **New avatar set.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -727,7 +727,7 @@ namespace NadekoBot.Modules.Administration await NadekoBot.Client.SetGame(game).ConfigureAwait(false); - await umsg.Channel.SendMessageAsync("πŸ‘Ύ **New game set.**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("πŸ‘Ύ **New game set.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -738,7 +738,7 @@ namespace NadekoBot.Modules.Administration await NadekoBot.Client.SetStream(name, url).ConfigureAwait(false); - await umsg.Channel.SendMessageAsync("ℹ️ **New stream set.**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("ℹ️ **New stream set.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -779,7 +779,7 @@ namespace NadekoBot.Modules.Administration } else { - await umsg.Channel.SendMessageAsync("⚠️ Invalid format.").ConfigureAwait(false); + await umsg.Channel.SendErrorAsync("⚠️ Invalid format.").ConfigureAwait(false); } } @@ -791,10 +791,10 @@ namespace NadekoBot.Modules.Administration g.GetDefaultChannelAsync() )).ConfigureAwait(false); - await Task.WhenAll(channels.Select(c => c.SendMessageAsync($"πŸ†• **Message from {umsg.Author} `(Bot Owner)`:** " + message))) + await Task.WhenAll(channels.Select(c => c.SendConfirmAsync($"πŸ†• Message from {umsg.Author} `[Bot Owner]`:", message))) .ConfigureAwait(false); - await umsg.Channel.SendMessageAsync("πŸ†—").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("πŸ†—").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -837,7 +837,7 @@ namespace NadekoBot.Modules.Administration { var channel = (ITextChannel)umsg.Channel; - string send = $"❕{umsg.Author.Mention} __`has invoked a mention on the following roles`__❕"; + string send = $"❕{umsg.Author.Mention} has invoked a mention on the following roles ❕"; foreach (var role in roles) { send += $"\n**{role.Name}**\n"; @@ -865,9 +865,7 @@ namespace NadekoBot.Modules.Administration { donatorsOrdered = uow.Donators.GetDonatorsOrdered(); } - - string str = $"**Thanks to the people listed below for making this project happen!**\n"; - await umsg.Channel.SendMessageAsync(str + string.Join("⭐", donatorsOrdered.Select(d => d.Name))).ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("Thanks to the people listed below for making this project happen!", string.Join("⭐", donatorsOrdered.Select(d => d.Name))).ConfigureAwait(false); nadekoSupportServer = nadekoSupportServer ?? NadekoBot.Client.GetGuild(117523346618318850); @@ -879,7 +877,7 @@ namespace NadekoBot.Modules.Administration return; var usrs = nadekoSupportServer.GetUsers().Where(u => u.Roles.Contains(patreonRole)); - await umsg.Channel.SendMessageAsync("\n`Patreon supporters:`\n" + string.Join("⭐", usrs.Select(d => d.Username))).ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("Patreon supporters", string.Join("⭐", usrs.Select(d => d.Username))).ConfigureAwait(false); } @@ -894,7 +892,7 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } - await umsg.Channel.SendMessageAsync($"Successfuly added a new donator. Total donated amount from this user: {don.Amount} πŸ‘‘").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync($"Successfuly added a new donator. Total donated amount from this user: {don.Amount} πŸ‘‘").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/AntiRaidCommands.cs b/src/NadekoBot/Modules/Administration/Commands/AntiRaidCommands.cs index 3003a00f..94191573 100644 --- a/src/NadekoBot/Modules/Administration/Commands/AntiRaidCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/AntiRaidCommands.cs @@ -1,6 +1,7 @@ ο»Ώusing Discord; using Discord.Commands; using NadekoBot.Attributes; +using NadekoBot.Extensions; using NLog; using System; using System.Collections.Concurrent; @@ -202,13 +203,13 @@ namespace NadekoBot.Modules.Administration if (userThreshold < 2 || userThreshold > 30) { - await channel.SendMessageAsync("❗️User threshold must be between **2** and **30**.").ConfigureAwait(false); + await channel.SendErrorAsync("❗️User threshold must be between **2** and **30**.").ConfigureAwait(false); return; } if (seconds < 2 || seconds > 300) { - await channel.SendMessageAsync("❗️Time must be between **2** and **300** seconds.").ConfigureAwait(false); + await channel.SendErrorAsync("❗️Time must be between **2** and **300** seconds.").ConfigureAwait(false); return; } @@ -218,7 +219,7 @@ namespace NadekoBot.Modules.Administration } catch (Exception ex) { - await channel.SendMessageAsync("⚠️ Failed creating a mute role. Give me ManageRoles permission" + + await channel.SendConfirmAsync("⚠️ Failed creating a mute role. Give me ManageRoles permission" + "or create 'nadeko-mute' role with disabled SendMessages and try again.") .ConfigureAwait(false); _log.Warn(ex); @@ -233,7 +234,7 @@ namespace NadekoBot.Modules.Administration }; antiRaidGuilds.AddOrUpdate(channel.Guild.Id, setting, (id, old) => setting); - await channel.SendMessageAsync($"ℹ️ {imsg.Author.Mention} If **{userThreshold}** or more users join within **{seconds}** seconds, I will **{action}** them.") + await channel.SendConfirmAsync($"ℹ️ {imsg.Author.Mention} If **{userThreshold}** or more users join within **{seconds}** seconds, I will **{action}** them.") .ConfigureAwait(false); } @@ -250,7 +251,7 @@ namespace NadekoBot.Modules.Administration AntiSpamSetting throwaway; if (antiSpamGuilds.TryRemove(channel.Guild.Id, out throwaway)) { - await channel.SendMessageAsync("πŸ†— **Anti-Spam feature** has been **disabled** on this server.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— **Anti-Spam feature** has been **disabled** on this server.").ConfigureAwait(false); } else { @@ -260,7 +261,7 @@ namespace NadekoBot.Modules.Administration } catch (Exception ex) { - await channel.SendMessageAsync("⚠️ Failed creating a mute role. Give me ManageRoles permission" + + await channel.SendErrorAsync("⚠️ Failed creating a mute role. Give me ManageRoles permission" + "or create 'nadeko-mute' role with disabled SendMessages and try again.") .ConfigureAwait(false); _log.Warn(ex); @@ -272,7 +273,7 @@ namespace NadekoBot.Modules.Administration Action = action, MessageThreshold = messageCount, })) - await channel.SendMessageAsync("βœ… **Anti-Spam feature** has been **enabled** on this server.").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… **Anti-Spam feature** has been **enabled** on this server.").ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Administration/Commands/AutoAssignRoleCommands.cs b/src/NadekoBot/Modules/Administration/Commands/AutoAssignRoleCommands.cs index 3511b454..f363fb93 100644 --- a/src/NadekoBot/Modules/Administration/Commands/AutoAssignRoleCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/AutoAssignRoleCommands.cs @@ -1,6 +1,7 @@ ο»Ώusing Discord; using Discord.Commands; using NadekoBot.Attributes; +using NadekoBot.Extensions; using NadekoBot.Services; using NadekoBot.Services.Database.Models; using NLog; @@ -67,11 +68,11 @@ namespace NadekoBot.Modules.Administration if (role == null) { - await channel.SendMessageAsync("πŸ†— **Auto assign role** on user join is now **disabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— **Auto assign role** on user join is now **disabled**.").ConfigureAwait(false); return; } - await channel.SendMessageAsync("βœ… **Auto assign role** on user join is now **enabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… **Auto assign role** on user join is now **enabled**.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs b/src/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs index fc71e58b..7867a078 100644 --- a/src/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs +++ b/src/NadekoBot/Modules/Administration/Commands/CrossServerTextChannel.cs @@ -67,7 +67,7 @@ namespace NadekoBot.Modules.Administration if (Subscribers.TryAdd(token, set)) { set.Add(channel); - await ((IGuildUser)msg.Author).SendMessageAsync("This is your CSC token:" + token.ToString()).ConfigureAwait(false); + await ((IGuildUser)msg.Author).SendConfirmAsync("This is your CSC token", token.ToString()).ConfigureAwait(false); } } @@ -82,7 +82,7 @@ namespace NadekoBot.Modules.Administration if (!Subscribers.TryGetValue(token, out set)) return; set.Add(channel); - await channel.SendMessageAsync(":ok:").ConfigureAwait(false); + await channel.SendConfirmAsync("Joined cross server channel.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Administration { subscriber.Value.TryRemove(channel); } - await channel.SendMessageAsync(":ok:").ConfigureAwait(false); + await channel.SendMessageAsync("Left cross server channel.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/DMForwardCommands.cs b/src/NadekoBot/Modules/Administration/Commands/DMForwardCommands.cs index 2930ecea..fac9949e 100644 --- a/src/NadekoBot/Modules/Administration/Commands/DMForwardCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/DMForwardCommands.cs @@ -1,6 +1,7 @@ ο»Ώusing Discord; using Discord.Commands; using NadekoBot.Attributes; +using NadekoBot.Extensions; using NadekoBot.Services; using System.Collections.Generic; using System.Linq; @@ -39,9 +40,9 @@ namespace NadekoBot.Modules.Administration uow.Complete(); } if (ForwardDMs) - await channel.SendMessageAsync("βœ… **I will forward DMs from now on.**").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… **I will forward DMs from now on.**").ConfigureAwait(false); else - await channel.SendMessageAsync("πŸ†— **I will stop forwarding DMs from now on.**").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— **I will stop forwarding DMs from now on.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -57,9 +58,9 @@ namespace NadekoBot.Modules.Administration uow.Complete(); } if (ForwardDMsToAllOwners) - await channel.SendMessageAsync("ℹ️ **I will forward DMs to all owners.**").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ **I will forward DMs to all owners.**").ConfigureAwait(false); else - await channel.SendMessageAsync("ℹ️ **I will forward DMs only to the first owner.**").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ **I will forward DMs only to the first owner.**").ConfigureAwait(false); } @@ -67,17 +68,17 @@ namespace NadekoBot.Modules.Administration { if (ForwardDMs && ownerChannels.Any()) { - var toSend = $"```markdown\n I received a message from [{msg.Author}]({msg.Author.Id}): {msg.Content}```"; + var title = $"DM from [{msg.Author}]({msg.Author.Id})"; if (ForwardDMsToAllOwners) { var msgs = await Task.WhenAll(ownerChannels.Where(ch => ch.Recipient.Id != msg.Author.Id) - .Select(ch => ch.SendMessageAsync(toSend))).ConfigureAwait(false); + .Select(ch => ch.SendConfirmAsync(title, msg.Content))).ConfigureAwait(false); } else { var firstOwnerChannel = ownerChannels.First(); if (firstOwnerChannel.Recipient.Id != msg.Author.Id) - try { await firstOwnerChannel.SendMessageAsync(toSend).ConfigureAwait(false); } catch { } + try { await firstOwnerChannel.SendConfirmAsync(title, msg.Content).ConfigureAwait(false); } catch { } } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs b/src/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs index 8f00eded..88b564a5 100644 --- a/src/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs +++ b/src/NadekoBot/Modules/Administration/Commands/MessageRepeater.cs @@ -2,6 +2,7 @@ using Discord.Commands; using Discord.WebSocket; using NadekoBot.Attributes; +using NadekoBot.Extensions; using NadekoBot.Services; using NadekoBot.Services.Database.Models; using NLog; @@ -88,11 +89,11 @@ namespace NadekoBot.Modules.Administration RepeatRunner rep; if (!repeaters.TryGetValue(channel.Id, out rep)) { - await channel.SendMessageAsync("ℹ️ **No repeating message found on this server.**").ConfigureAwait(false); + await channel.SendErrorAsync("ℹ️ **No repeating message found on this server.**").ConfigureAwait(false); return; } rep.Reset(); - await channel.SendMessageAsync("πŸ”„ " + rep.Repeater.Message).ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ”„ " + rep.Repeater.Message).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -110,10 +111,10 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } rep.Stop(); - await channel.SendMessageAsync("βœ… **Stopped repeating a message.**").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… **Stopped repeating a message.**").ConfigureAwait(false); } else - await channel.SendMessageAsync("ℹ️ **No message is repeating.**").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ **No message is repeating.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -159,7 +160,7 @@ namespace NadekoBot.Modules.Administration return old; }); - await channel.SendMessageAsync($"πŸ” Repeating **\"{rep.Repeater.Message}\"** every `{rep.Repeater.Interval.Days} day(s), {rep.Repeater.Interval.Hours} hour(s) and {rep.Repeater.Interval.Minutes} minute(s)`.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ” Repeating **\"{rep.Repeater.Message}\"** every `{rep.Repeater.Interval.Days} day(s), {rep.Repeater.Interval.Hours} hour(s) and {rep.Repeater.Interval.Minutes} minute(s)`.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs b/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs index 3bf25b61..2d8e7921 100644 --- a/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/PlayingRotateCommands.cs @@ -98,9 +98,9 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } if (RotatingStatuses) - await umsg.Channel.SendMessageAsync("πŸ†— **Rotating playing status enabled.**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("πŸ†— **Rotating playing status enabled.**").ConfigureAwait(false); else - await umsg.Channel.SendMessageAsync("ℹ️ **Rotating playing status disabled.**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("ℹ️ **Rotating playing status disabled.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } - await umsg.Channel.SendMessageAsync("βœ… **Added.**").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync("βœ… **Added.**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -124,11 +124,11 @@ namespace NadekoBot.Modules.Administration public async Task ListPlaying(IUserMessage umsg) { if (!RotatingStatusMessages.Any()) - await umsg.Channel.SendMessageAsync("❎ **No rotating playing statuses set.**"); + await umsg.Channel.SendErrorAsync("❎ **No rotating playing statuses set.**"); else { var i = 1; - await umsg.Channel.SendMessageAsync($"ℹ️ {umsg.Author.Mention} `Here is a list of rotating statuses:`\n\n\t" + string.Join("\n\t", RotatingStatusMessages.Select(rs => $"`{i++}.` {rs.Status}"))); + await umsg.Channel.SendConfirmAsync($"ℹ️ {umsg.Author.Mention} `Here is a list of rotating statuses:`\n\n\t" + string.Join("\n\t", RotatingStatusMessages.Select(rs => $"`{i++}.` {rs.Status}"))); } } @@ -151,7 +151,7 @@ namespace NadekoBot.Modules.Administration RotatingStatusMessages.RemoveAt(index); await uow.CompleteAsync(); } - await umsg.Channel.SendMessageAsync($"πŸ—‘ **Removed the the playing message:** {msg}").ConfigureAwait(false); + await umsg.Channel.SendConfirmAsync($"πŸ—‘ **Removed the the playing message:** {msg}").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs b/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs index fe9b4639..d4e74299 100644 --- a/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs @@ -94,7 +94,7 @@ namespace NadekoBot.Modules.Administration if (RatelimitingChannels.TryRemove(channel.Id, out throwaway)) { throwaway.cancelSource.Cancel(); - await channel.SendMessageAsync("ℹ️ **Slow mode disabled.**").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Slow mode disabled.").ConfigureAwait(false); return; } } @@ -109,7 +109,7 @@ namespace NadekoBot.Modules.Administration if (msg < 1 || perSec < 1 || msg > 100 || perSec > 3600) { - await channel.SendMessageAsync("⚠️ `Invalid parameters.`"); + await channel.SendErrorAsync("⚠️ Invalid parameters."); return; } var toAdd = new Ratelimiter() @@ -120,8 +120,8 @@ namespace NadekoBot.Modules.Administration }; if(RatelimitingChannels.TryAdd(channel.Id, toAdd)) { - await channel.SendMessageAsync("βœ… **Slow mode initiated: " + - $"Users can't send more than `{toAdd.MaxMessages} message(s)` every `{toAdd.PerSeconds} second(s)`.**") + await channel.SendConfirmAsync("Slow mode initiated", + $"Users can't send more than `{toAdd.MaxMessages} message(s)` every `{toAdd.PerSeconds} second(s)`.") .ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs b/src/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs index 2e8a0b87..dfd8b0a7 100644 --- a/src/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/SelfAssignedRolesCommand.cs @@ -1,6 +1,7 @@ ο»Ώusing Discord; using Discord.Commands; using NadekoBot.Attributes; +using NadekoBot.Extensions; using NadekoBot.Services; using NadekoBot.Services.Database.Models; using System; @@ -32,7 +33,7 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"ℹ️ Automatic deleting of `iam` and `iamn` confirmations has been {(newval ? "**enabled**" : "**disabled**")}.") + await channel.SendConfirmAsync($"ℹ️ Automatic deleting of `iam` and `iamn` confirmations has been {(newval ? "**enabled**" : "**disabled**")}.") .ConfigureAwait(false); } @@ -51,7 +52,8 @@ namespace NadekoBot.Modules.Administration roles = uow.SelfAssignedRoles.GetFromGuild(channel.Guild.Id); if (roles.Any(s => s.RoleId == role.Id && s.GuildId == role.GuildId)) { - msg = $"πŸ’’ Role **{role.Name}** is already in the list."; + await channel.SendMessageAsync($"πŸ’’ Role **{role.Name}** is already in the list.").ConfigureAwait(false); + return; } else { @@ -63,7 +65,7 @@ namespace NadekoBot.Modules.Administration msg = $"πŸ†— Role **{role.Name}** added to the list."; } } - await channel.SendMessageAsync(msg.ToString()).ConfigureAwait(false); + await channel.SendConfirmAsync(msg.ToString()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -81,10 +83,10 @@ namespace NadekoBot.Modules.Administration } if (!success) { - await channel.SendMessageAsync("❎ That role is not self-assignable.").ConfigureAwait(false); + await channel.SendErrorAsync("❎ That role is not self-assignable.").ConfigureAwait(false); return; } - await channel.SendMessageAsync($"πŸ—‘ **{role.Name}** has been removed from the list of self-assignable roles.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ—‘ **{role.Name}** has been removed from the list of self-assignable roles.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -96,10 +98,12 @@ namespace NadekoBot.Modules.Administration var toRemove = new ConcurrentHashSet(); var removeMsg = new StringBuilder(); var msg = new StringBuilder(); + var roleCnt = 0; using (var uow = DbHandler.UnitOfWork()) { - var roleModels = uow.SelfAssignedRoles.GetFromGuild(channel.Guild.Id); - msg.AppendLine($"ℹ️ There are `{roleModels.Count()}` self assignable roles:"); + var roleModels = uow.SelfAssignedRoles.GetFromGuild(channel.Guild.Id).ToList(); + roleCnt = roleModels.Count; + msg.AppendLine(); foreach (var roleModel in roleModels) { @@ -119,7 +123,7 @@ namespace NadekoBot.Modules.Administration } await uow.CompleteAsync(); } - await channel.SendMessageAsync(msg.ToString() + "\n\n" + removeMsg.ToString()).ConfigureAwait(false); + await channel.SendConfirmAsync($"ℹ️ There are `{roleCnt}` self assignable roles:", msg.ToString() + "\n\n" + removeMsg.ToString()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -138,7 +142,7 @@ namespace NadekoBot.Modules.Administration await uow.CompleteAsync(); } string exl = areExclusive ? "**exclusive**." : "**not exclusive**."; - await channel.SendMessageAsync("ℹ️ Self assigned roles are now " + exl); + await channel.SendConfirmAsync("ℹ️ Self assigned roles are now " + exl); } [NadekoCommand, Usage, Description, Aliases] @@ -159,12 +163,12 @@ namespace NadekoBot.Modules.Administration SelfAssignedRole roleModel; if ((roleModel = roles.FirstOrDefault(r=>r.RoleId == role.Id)) == null) { - await channel.SendMessageAsync("πŸ’’ That role is not self-assignable.").ConfigureAwait(false); + await channel.SendErrorAsync("That role is not self-assignable.").ConfigureAwait(false); return; } if (guildUser.Roles.Contains(role)) { - await channel.SendMessageAsync($"❎ You already have **{role.Name}** role.").ConfigureAwait(false); + await channel.SendErrorAsync($"You already have **{role.Name}** role.").ConfigureAwait(false); return; } @@ -173,7 +177,7 @@ namespace NadekoBot.Modules.Administration var sameRoles = guildUser.Roles.Where(r => roles.Any(rm => rm.RoleId == r.Id)); if (sameRoles.Any()) { - await channel.SendMessageAsync($"❎ You already have **{sameRoles.FirstOrDefault().Name}** `exclusive self-assigned` role.").ConfigureAwait(false); + await channel.SendErrorAsync($"You already have **{sameRoles.FirstOrDefault().Name}** `exclusive self-assigned` role.").ConfigureAwait(false); return; } } @@ -183,11 +187,11 @@ namespace NadekoBot.Modules.Administration } catch (Exception ex) { - await channel.SendMessageAsync($"⚠️ I am unable to add that role to you. `I can't add roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false); + await channel.SendErrorAsync($"⚠️ I am unable to add that role to you. `I can't add roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false); Console.WriteLine(ex); return; } - var msg = await channel.SendMessageAsync($"πŸ†— You now have **{role.Name}** role.").ConfigureAwait(false); + var msg = await channel.SendConfirmAsync($"πŸ†— You now have **{role.Name}** role.").ConfigureAwait(false); if (conf.AutoDeleteSelfAssignedRoleMessages) { @@ -217,12 +221,12 @@ namespace NadekoBot.Modules.Administration SelfAssignedRole roleModel; if ((roleModel = roles.FirstOrDefault(r => r.RoleId == role.Id)) == null) { - await channel.SendMessageAsync("πŸ’’ That role is not self-assignable.").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ’’ That role is not self-assignable.").ConfigureAwait(false); return; } if (!guildUser.Roles.Contains(role)) { - await channel.SendMessageAsync($"❎ You don't have **{role.Name}** role.").ConfigureAwait(false); + await channel.SendErrorAsync($"❎ You don't have **{role.Name}** role.").ConfigureAwait(false); return; } try @@ -231,10 +235,10 @@ namespace NadekoBot.Modules.Administration } catch (Exception) { - await channel.SendMessageAsync($"⚠️ I am unable to add that role to you. `I can't remove roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false); + await channel.SendErrorAsync($"⚠️ I am unable to add that role to you. `I can't remove roles to owners or other roles higher than my role in the role hierarchy.`").ConfigureAwait(false); return; } - var msg = await channel.SendMessageAsync($"πŸ†— You no longer have **{role.Name}** role.").ConfigureAwait(false); + var msg = await channel.SendConfirmAsync($"πŸ†— You no longer have **{role.Name}** role.").ConfigureAwait(false); if (autoDeleteSelfAssignedRoleMessages) { diff --git a/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs b/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs index d153a2dd..b750a26c 100644 --- a/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/SelfCommands.cs @@ -1,6 +1,7 @@ ο»Ώusing Discord; using Discord.Commands; using NadekoBot.Attributes; +using NadekoBot.Extensions; using System.Linq; using System.Threading.Tasks; @@ -31,18 +32,18 @@ namespace NadekoBot.Modules.Administration if (server == null) { - await channel.SendMessageAsync("⚠️ Cannot find that server").ConfigureAwait(false); + await channel.SendErrorAsync("⚠️ Cannot find that server").ConfigureAwait(false); return; } if (server.OwnerId != _client.GetCurrentUser().Id) { await server.LeaveAsync().ConfigureAwait(false); - await channel.SendMessageAsync("βœ… Left server " + server.Name).ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… Left server " + server.Name).ConfigureAwait(false); } else { await server.DeleteAsync().ConfigureAwait(false); - await channel.SendMessageAsync("Deleted server " + server.Name).ConfigureAwait(false); + await channel.SendConfirmAsync("Deleted server " + server.Name).ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs index 94d0589b..1a42e613 100644 --- a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs @@ -112,7 +112,7 @@ namespace NadekoBot.Modules.Administration var msg = conf.DmGreetMessageText.Replace("%user%", user.Username).Replace("%server%", user.Guild.Name); if (!string.IsNullOrWhiteSpace(msg)) { - await channel.SendMessageAsync(msg).ConfigureAwait(false); + await channel.SendConfirmAsync(msg).ConfigureAwait(false); } } } @@ -134,9 +134,9 @@ namespace NadekoBot.Modules.Administration await ServerGreetCommands.SetGreetDel(channel.Guild.Id, timer).ConfigureAwait(false); if (timer > 0) - await channel.SendMessageAsync($"πŸ†— Greet messages **will be deleted** after `{timer} seconds`.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ†— Greet messages **will be deleted** after `{timer} seconds`.").ConfigureAwait(false); else - await channel.SendMessageAsync("ℹ️ Automatic deletion of greet messages has been **disabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Automatic deletion of greet messages has been **disabled**.").ConfigureAwait(false); } private static async Task SetGreetDel(ulong id, int timer) @@ -163,9 +163,9 @@ namespace NadekoBot.Modules.Administration var enabled = await ServerGreetCommands.SetGreet(channel.Guild.Id, channel.Id).ConfigureAwait(false); if (enabled) - await channel.SendMessageAsync("βœ… Greeting messages **enabled** on this channel.").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… Greeting messages **enabled** on this channel.").ConfigureAwait(false); else - await channel.SendMessageAsync("ℹ️ Greeting messages **disabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Greeting messages **disabled**.").ConfigureAwait(false); } private static async Task SetGreet(ulong guildId, ulong channelId, bool? value = null) @@ -196,15 +196,15 @@ namespace NadekoBot.Modules.Administration { channelGreetMessageText = uow.GuildConfigs.For(channel.Guild.Id, set => set).ChannelGreetMessageText; } - await channel.SendMessageAsync("ℹ️ Current **greet** message: `" + channelGreetMessageText?.SanitizeMentions() + "`"); + await channel.SendConfirmAsync("Current greet message: ", channelGreetMessageText?.SanitizeMentions()); return; } var sendGreetEnabled = ServerGreetCommands.SetGreetMessage(channel.Guild.Id, ref text); - await channel.SendMessageAsync("πŸ†— New greet message **set**.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— New greet message **set**.").ConfigureAwait(false); if (!sendGreetEnabled) - await channel.SendMessageAsync("ℹ️ Enable greet messsages by typing `.greet`").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Enable greet messsages by typing `.greet`").ConfigureAwait(false); } public static bool SetGreetMessage(ulong guildId, ref string message) @@ -236,9 +236,9 @@ namespace NadekoBot.Modules.Administration var enabled = await ServerGreetCommands.SetGreetDm(channel.Guild.Id).ConfigureAwait(false); if (enabled) - await channel.SendMessageAsync("πŸ†— DM Greet announcements **enabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— DM Greet announcements **enabled**.").ConfigureAwait(false); else - await channel.SendMessageAsync("ℹ️ Greet announcements **disabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Greet announcements **disabled**.").ConfigureAwait(false); } private static async Task SetGreetDm(ulong guildId, bool? value = null) @@ -268,15 +268,15 @@ namespace NadekoBot.Modules.Administration { config = uow.GuildConfigs.For(channel.Guild.Id); } - await channel.SendMessageAsync("ℹ️ Current **DM greet** message: `" + config.DmGreetMessageText?.SanitizeMentions() + "`"); + await channel.SendConfirmAsync("ℹ️ Current **DM greet** message: `" + config.DmGreetMessageText?.SanitizeMentions() + "`"); return; } var sendGreetEnabled = ServerGreetCommands.SetGreetDmMessage(channel.Guild.Id, ref text); - await channel.SendMessageAsync("πŸ†— New DM greet message **set**.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— New DM greet message **set**.").ConfigureAwait(false); if (!sendGreetEnabled) - await channel.SendMessageAsync($"ℹ️ Enable DM greet messsages by typing `{NadekoBot.ModulePrefixes[typeof(Administration).Name]}greetdm`").ConfigureAwait(false); + await channel.SendConfirmAsync($"ℹ️ Enable DM greet messsages by typing `{NadekoBot.ModulePrefixes[typeof(Administration).Name]}greetdm`").ConfigureAwait(false); } public static bool SetGreetDmMessage(ulong guildId, ref string message) @@ -308,9 +308,9 @@ namespace NadekoBot.Modules.Administration var enabled = await ServerGreetCommands.SetBye(channel.Guild.Id, channel.Id).ConfigureAwait(false); if (enabled) - await channel.SendMessageAsync("βœ… Bye announcements **enabled** on this channel.").ConfigureAwait(false); + await channel.SendConfirmAsync("βœ… Bye announcements **enabled** on this channel.").ConfigureAwait(false); else - await channel.SendMessageAsync("ℹ️ Bye announcements **disabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Bye announcements **disabled**.").ConfigureAwait(false); } private static async Task SetBye(ulong guildId, ulong channelId, bool? value = null) @@ -341,15 +341,15 @@ namespace NadekoBot.Modules.Administration { byeMessageText = uow.GuildConfigs.For(channel.Guild.Id, set => set).ChannelByeMessageText; } - await channel.SendMessageAsync("ℹ️ Current **bye** message: `" + byeMessageText?.SanitizeMentions() + "`"); + await channel.SendConfirmAsync("ℹ️ Current **bye** message: `" + byeMessageText?.SanitizeMentions() + "`"); return; } var sendByeEnabled = ServerGreetCommands.SetByeMessage(channel.Guild.Id, ref text); - await channel.SendMessageAsync("πŸ†— New bye message **set**.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— New bye message **set**.").ConfigureAwait(false); if (!sendByeEnabled) - await channel.SendMessageAsync($"ℹ️ Enable bye messsages by typing `{NadekoBot.ModulePrefixes[typeof(Administration).Name]}bye`").ConfigureAwait(false); + await channel.SendConfirmAsync($"ℹ️ Enable bye messsages by typing `{NadekoBot.ModulePrefixes[typeof(Administration).Name]}bye`").ConfigureAwait(false); } public static bool SetByeMessage(ulong guildId, ref string message) @@ -381,9 +381,9 @@ namespace NadekoBot.Modules.Administration await ServerGreetCommands.SetByeDel(channel.Guild.Id, timer).ConfigureAwait(false); if (timer > 0) - await channel.SendMessageAsync($"πŸ†— Bye messages **will be deleted** after `{timer} seconds`.").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ†— Bye messages **will be deleted** after `{timer} seconds`.").ConfigureAwait(false); else - await channel.SendMessageAsync("ℹ️ Automatic deletion of bye messages has been **disabled**.").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Automatic deletion of bye messages has been **disabled**.").ConfigureAwait(false); } private static async Task SetByeDel(ulong id, int timer) diff --git a/src/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommands.cs b/src/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommands.cs index a6ca255f..4ffff33a 100644 --- a/src/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/VoicePlusTextCommands.cs @@ -51,7 +51,7 @@ namespace NadekoBot.Modules.Administration { try { - await (await guild.GetOwnerAsync()).SendMessageAsync( + await (await guild.GetOwnerAsync()).SendErrorAsync( "⚠️ I don't have **manage server** and/or **manage channels** permission," + $" so I cannot run `voice+text` on **{guild.Name}** server.").ConfigureAwait(false); } @@ -116,7 +116,7 @@ namespace NadekoBot.Modules.Administration var botUser = await guild.GetCurrentUserAsync().ConfigureAwait(false); if (!botUser.GuildPermissions.ManageRoles || !botUser.GuildPermissions.ManageChannels) { - await channel.SendMessageAsync("πŸ’’ I require atleast **manage roles** and **manage channels permissions** to enable this feature. `(preffered Administration permission)`"); + await channel.SendErrorAsync("I require atleast **manage roles** and **manage channels permissions** to enable this feature. `(preffered Administration permission)`"); return; } @@ -124,7 +124,7 @@ namespace NadekoBot.Modules.Administration { try { - await channel.SendMessageAsync("⚠️ You are enabling this feature and **I do not have ADMINISTRATOR permissions**. " + + await channel.SendErrorAsync("⚠️ You are enabling this feature and **I do not have ADMINISTRATOR permissions**. " + "`This may cause some issues, and you will have to clean up text channels yourself afterwards.`"); } catch { } @@ -145,16 +145,16 @@ namespace NadekoBot.Modules.Administration { try { await textChannel.DeleteAsync().ConfigureAwait(false); } catch { } } - await channel.SendMessageAsync("ℹ️ Successfuly **removed** voice + text feature.").ConfigureAwait(false); + await channel.SendConfirmAsync("ℹ️ Successfuly **removed** voice + text feature.").ConfigureAwait(false); return; } voicePlusTextCache.Add(guild.Id); - await channel.SendMessageAsync("πŸ†— Successfuly **enabled** voice + text feature.").ConfigureAwait(false); + await channel.SendConfirmAsync("πŸ†— Successfuly **enabled** voice + text feature.").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync(ex.ToString()).ConfigureAwait(false); + await channel.SendErrorAsync(ex.ToString()).ConfigureAwait(false); } } [NadekoCommand, Usage, Description, Aliases] @@ -168,7 +168,7 @@ namespace NadekoBot.Modules.Administration var botUser = await guild.GetCurrentUserAsync().ConfigureAwait(false); if (!botUser.GuildPermissions.Administrator) { - await channel.SendMessageAsync("⚠️ I need **Administrator permission** to do that.").ConfigureAwait(false); + await channel.SendErrorAsync("I need **Administrator permission** to do that.").ConfigureAwait(false); return; } @@ -183,7 +183,7 @@ namespace NadekoBot.Modules.Administration await Task.Delay(500); } - await channel.SendMessageAsync("βœ… Done.").ConfigureAwait(false); + await channel.SendConfirmAsync("Cleaned v+t.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs b/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs index 4a61127a..81be7144 100644 --- a/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs +++ b/src/NadekoBot/Modules/ClashOfClans/ClashOfClans.cs @@ -10,6 +10,7 @@ using NadekoBot.Attributes; using Discord.WebSocket; using NadekoBot.Services.Database.Models; using System.Linq; +using NadekoBot.Extensions; namespace NadekoBot.Modules.ClashOfClans { @@ -49,7 +50,7 @@ namespace NadekoBot.Modules.ClashOfClans if (!Bases[i].BaseDestroyed && DateTime.UtcNow - Bases[i].TimeAdded >= callExpire) { Bases[i] = null; - try { await war.Channel.SendMessageAsync($"β—πŸ”°**Claim from @{Bases[i].CallUser} for a war against {war.ShortPrint()} has expired.**").ConfigureAwait(false); } catch { } + try { await war.Channel.SendErrorAsync($"β—πŸ”°**Claim from @{Bases[i].CallUser} for a war against {war.ShortPrint()} has expired.**").ConfigureAwait(false); } catch { } } } } @@ -68,7 +69,7 @@ namespace NadekoBot.Modules.ClashOfClans if (size < 10 || size > 50 || size % 5 != 0) { - await channel.SendMessageAsync("πŸ’’πŸ”° Not a Valid war size").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° Not a Valid war size").ConfigureAwait(false); return; } List wars; @@ -83,7 +84,7 @@ namespace NadekoBot.Modules.ClashOfClans var cw = await CreateWar(enemyClan, size, channel.Guild.Id, umsg.Channel.Id); wars.Add(cw); - await channel.SendMessageAsync($"β—πŸ”°**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false); + await channel.SendConfirmAsync($"β—πŸ”°**CREATED CLAN WAR AGAINST {cw.ShortPrint()}**").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -98,18 +99,18 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(umsg, num); if (warsInfo == null) { - await channel.SendMessageAsync("πŸ’’πŸ”° **That war does not exist.**").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° **That war does not exist.**").ConfigureAwait(false); return; } var war = warsInfo.Item1[warsInfo.Item2]; try { war.Start(); - await channel.SendMessageAsync($"πŸ”°**STARTED WAR AGAINST {war.ShortPrint()}**").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ”°**STARTED WAR AGAINST {war.ShortPrint()}**").ConfigureAwait(false); } catch { - await channel.SendMessageAsync($"πŸ”°**WAR AGAINST {war.ShortPrint()} HAS ALREADY STARTED**").ConfigureAwait(false); + await channel.SendErrorAsync($"πŸ”°**WAR AGAINST {war.ShortPrint()} HAS ALREADY STARTED**").ConfigureAwait(false); } SaveWar(war); } @@ -128,7 +129,7 @@ namespace NadekoBot.Modules.ClashOfClans ClashWars.TryGetValue(channel.Guild.Id, out wars); if (wars == null || wars.Count == 0) { - await channel.SendMessageAsync("πŸ”° **No active wars.**").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° **No active wars.**").ConfigureAwait(false); return; } @@ -141,7 +142,7 @@ namespace NadekoBot.Modules.ClashOfClans sb.AppendLine($"\t\t`Size:` **{wars[i].Size} v {wars[i].Size}**"); sb.AppendLine("**-------------------------**"); } - await channel.SendMessageAsync(sb.ToString()).ConfigureAwait(false); + await channel.SendConfirmAsync(sb.ToString()).ConfigureAwait(false); return; } @@ -151,10 +152,10 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(umsg, num); if (warsInfo == null) { - await channel.SendMessageAsync("πŸ’’πŸ”° **That war does not exist.**").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° **That war does not exist.**").ConfigureAwait(false); return; } - await channel.SendMessageAsync(warsInfo.Item1[warsInfo.Item2].ToPrettyString()).ConfigureAwait(false); + await channel.SendConfirmAsync(warsInfo.Item1[warsInfo.Item2].ToPrettyString()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -165,7 +166,7 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(umsg, number); if (warsInfo == null || warsInfo.Item1.Count == 0) { - await channel.SendMessageAsync("πŸ’’πŸ”° **That war does not exist.**").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° **That war does not exist.**").ConfigureAwait(false); return; } var usr = @@ -177,11 +178,11 @@ namespace NadekoBot.Modules.ClashOfClans var war = warsInfo.Item1[warsInfo.Item2]; war.Call(usr, baseNumber - 1); SaveWar(war); - await channel.SendMessageAsync($"πŸ”°**{usr}** claimed a base #{baseNumber} for a war against {war.ShortPrint()}").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ”°**{usr}** claimed a base #{baseNumber} for a war against {war.ShortPrint()}").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync($"πŸ’’πŸ”° {ex.Message}").ConfigureAwait(false); + await channel.SendErrorAsync($"πŸ”° {ex.Message}").ConfigureAwait(false); } } @@ -218,13 +219,13 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(umsg,number); if (warsInfo == null) { - await channel.SendMessageAsync("πŸ’’πŸ”° That war does not exist.").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° That war does not exist.").ConfigureAwait(false); return; } var war = warsInfo.Item1[warsInfo.Item2]; war.End(); SaveWar(war); - await channel.SendMessageAsync($"β—πŸ”°**War against {warsInfo.Item1[warsInfo.Item2].ShortPrint()} ended.**").ConfigureAwait(false); + await channel.SendConfirmAsync($"β—πŸ”°**War against {warsInfo.Item1[warsInfo.Item2].ShortPrint()} ended.**").ConfigureAwait(false); var size = warsInfo.Item1[warsInfo.Item2].Size; warsInfo.Item1.RemoveAt(warsInfo.Item2); @@ -239,7 +240,7 @@ namespace NadekoBot.Modules.ClashOfClans var warsInfo = GetWarInfo(umsg, number); if (warsInfo == null || warsInfo.Item1.Count == 0) { - await channel.SendMessageAsync("πŸ’’πŸ”° **That war does not exist.**").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° **That war does not exist.**").ConfigureAwait(false); return; } var usr = @@ -251,11 +252,11 @@ namespace NadekoBot.Modules.ClashOfClans var war = warsInfo.Item1[warsInfo.Item2]; var baseNumber = war.Uncall(usr); SaveWar(war); - await channel.SendMessageAsync($"πŸ”° @{usr} has **UNCLAIMED** a base #{baseNumber + 1} from a war against {war.ShortPrint()}").ConfigureAwait(false); + await channel.SendConfirmAsync($"πŸ”° @{usr} has **UNCLAIMED** a base #{baseNumber + 1} from a war against {war.ShortPrint()}").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync($"πŸ’’πŸ”° {ex.Message}").ConfigureAwait(false); + await channel.SendErrorAsync($"πŸ”° {ex.Message}").ConfigureAwait(false); } } @@ -265,7 +266,7 @@ namespace NadekoBot.Modules.ClashOfClans var warInfo = GetWarInfo(umsg, number); if (warInfo == null || warInfo.Item1.Count == 0) { - await channel.SendMessageAsync("πŸ’’πŸ”° **That war does not exist.**").ConfigureAwait(false); + await channel.SendErrorAsync("πŸ”° **That war does not exist.**").ConfigureAwait(false); return; } var war = warInfo.Item1[warInfo.Item2]; @@ -280,11 +281,11 @@ namespace NadekoBot.Modules.ClashOfClans { war.FinishClaim(baseNumber, stars); } - await channel.SendMessageAsync($"β—πŸ”°{umsg.Author.Mention} **DESTROYED** a base #{baseNumber + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false); + await channel.SendConfirmAsync($"β—πŸ”°{umsg.Author.Mention} **DESTROYED** a base #{baseNumber + 1} in a war against {war.ShortPrint()}").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync($"πŸ’’πŸ”° {ex.Message}").ConfigureAwait(false); + await channel.SendErrorAsync($"πŸ”° {ex.Message}").ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs index 7dfa0cb5..fd96a7fe 100644 --- a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -77,7 +77,7 @@ namespace NadekoBot.Modules.CustomReactions if ((channel == null && !NadekoBot.Credentials.IsOwner(imsg.Author)) || (channel != null && !((IGuildUser)imsg.Author).GuildPermissions.Administrator)) { - try { await imsg.Channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } + try { await imsg.Channel.SendErrorAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } return; } @@ -106,7 +106,12 @@ namespace NadekoBot.Modules.CustomReactions reactions.Add(cr); } - await imsg.Channel.SendMessageAsync($"`Added new custom reaction {cr.Id}:`\n\t`Trigger:` {key}\n\t`Response:` {message}").ConfigureAwait(false); + await imsg.Channel.EmbedAsync(new EmbedBuilder().WithColor(NadekoBot.OkColor) + .WithTitle("New Custom Reaction") + .WithDescription($"#{cr.Id}") + .AddField(efb => efb.WithName("Trigger").WithValue(key)) + .AddField(efb => efb.WithName("Response").WithValue(message)) + .Build()).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -124,16 +129,15 @@ namespace NadekoBot.Modules.CustomReactions customReactions = GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet()); if (customReactions == null || !customReactions.Any()) - await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false); + await imsg.Channel.SendErrorAsync("No custom reactions found").ConfigureAwait(false); else - await imsg.Channel.SendMessageAsync( - $"`Page {page} of custom reactions:`\n" + - string.Join("\n", customReactions - .OrderBy(cr => cr.Trigger) - .Skip((page - 1) * 20) - .Take(20) - .Select(cr => $"`#{cr.Id}` `Trigger:` {cr.Trigger}"))) - .ConfigureAwait(false); + await imsg.Channel.SendConfirmAsync( + $"Page {page} of custom reactions:", + string.Join("\n", customReactions.OrderBy(cr => cr.Trigger) + .Skip((page - 1) * 20) + .Take(20) + .Select(cr => $"`#{cr.Id}` `Trigger:` {cr.Trigger}"))) + .ConfigureAwait(false); } public enum All @@ -154,7 +158,7 @@ namespace NadekoBot.Modules.CustomReactions customReactions = GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet()); if (customReactions == null || !customReactions.Any()) - await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false); + await imsg.Channel.SendErrorAsync("No custom reactions found").ConfigureAwait(false); else { var txtStream = await customReactions.GroupBy(cr => cr.Trigger) @@ -183,9 +187,9 @@ namespace NadekoBot.Modules.CustomReactions customReactions = GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet()); if (customReactions == null || !customReactions.Any()) - await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false); + await imsg.Channel.SendErrorAsync("No custom reactions found").ConfigureAwait(false); else - await imsg.Channel.SendMessageAsync($"{imsg.Author.Mention}\n`Page {page} of custom reactions (grouped):`\n" + + await imsg.Channel.SendConfirmAsync($"Page {page} of custom reactions (grouped):", string.Join("\r\n", customReactions .GroupBy(cr=>cr.Trigger) .OrderBy(cr => cr.Key) @@ -209,11 +213,14 @@ namespace NadekoBot.Modules.CustomReactions var found = customReactions.FirstOrDefault(cr => cr.Id == id); if (found == null) - await imsg.Channel.SendMessageAsync("`No custom reaction found with that id.`").ConfigureAwait(false); + await imsg.Channel.SendErrorAsync("No custom reaction found with that id.").ConfigureAwait(false); else { - await imsg.Channel.SendMessageAsync($"`Custom reaction #{id}`\n`Trigger:` {found.Trigger}\n`Response:` {found.Response} ```css\n{found.Response}```") - .ConfigureAwait(false); + await imsg.Channel.EmbedAsync(new EmbedBuilder().WithColor(NadekoBot.OkColor) + .WithDescription($"#{id}") + .AddField(efb => efb.WithName("Trigger").WithValue(found.Trigger)) + .AddField(efb => efb.WithName("Response").WithValue(found.Response + "\n```css\n" + found.Response + "```" )) + .Build()).ConfigureAwait(false); } } @@ -224,7 +231,7 @@ namespace NadekoBot.Modules.CustomReactions if ((channel == null && !NadekoBot.Credentials.IsOwner(imsg.Author)) || (channel != null && !((IGuildUser)imsg.Author).GuildPermissions.Administrator)) { - try { await imsg.Channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } + try { await imsg.Channel.SendErrorAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } return; } @@ -253,9 +260,9 @@ namespace NadekoBot.Modules.CustomReactions } if (success) - await imsg.Channel.SendMessageAsync("**Successfully deleted custom reaction** " + toDelete.ToString()).ConfigureAwait(false); + await imsg.Channel.SendConfirmAsync("Deleted custom reaction", toDelete.ToString()).ConfigureAwait(false); else - await imsg.Channel.SendMessageAsync("`Failed to find that custom reaction.`").ConfigureAwait(false); + await imsg.Channel.SendErrorAsync("Failed to find that custom reaction.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs b/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs index 9dc5de5b..d462d572 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/AnimalRacing.cs @@ -29,7 +29,7 @@ namespace NadekoBot.Modules.Gambling var ar = new AnimalRace(channel.Guild.Id, channel); if (ar.Fail) - await channel.SendMessageAsync("🏁 `Failed starting a race. Another race is probably running.`"); + await channel.SendErrorAsync("🏁 `Failed starting a race. Another race is probably running.`"); } [NadekoCommand, Usage, Description, Aliases] @@ -45,7 +45,7 @@ namespace NadekoBot.Modules.Gambling AnimalRace ar; if (!AnimalRaces.TryGetValue(channel.Guild.Id, out ar)) { - await channel.SendMessageAsync("No race exists on this server"); + await channel.SendErrorAsync("No race exists on this server"); return; } await ar.JoinRace(umsg.Author as IGuildUser, amount); @@ -90,21 +90,21 @@ namespace NadekoBot.Modules.Gambling { try { - try { await raceChannel.SendMessageAsync($"🏁`Race is starting in 20 seconds or when the room is full. Type {NadekoBot.ModulePrefixes[typeof(Gambling).Name]}jr to join the race.`"); } catch (Exception ex) { _log.Warn(ex); } + try { await raceChannel.SendConfirmAsync($"🏁`Race is starting in 20 seconds or when the room is full. Type {NadekoBot.ModulePrefixes[typeof(Gambling).Name]}jr to join the race.`"); } catch (Exception ex) { _log.Warn(ex); } var t = await Task.WhenAny(Task.Delay(20000, token), fullgame); Started = true; cancelSource.Cancel(); if (t == fullgame) { - try { await raceChannel.SendMessageAsync("🏁`Race full, starting right now!`"); } catch (Exception ex) { _log.Warn(ex); } + try { await raceChannel.SendConfirmAsync("🏁`Race full, starting right now!`"); } catch (Exception ex) { _log.Warn(ex); } } else if (participants.Count > 1) { - try { await raceChannel.SendMessageAsync("🏁`Game starting with " + participants.Count + " participants.`"); } catch (Exception ex) { _log.Warn(ex); } + try { await raceChannel.SendConfirmAsync("🏁`Game starting with " + participants.Count + " participants.`"); } catch (Exception ex) { _log.Warn(ex); } } else { - try { await raceChannel.SendMessageAsync("🏁`Race failed to start since there was not enough participants.`"); } catch (Exception ex) { _log.Warn(ex); } + try { await raceChannel.SendErrorAsync("🏁`Race failed to start since there was not enough participants.`"); } catch (Exception ex) { _log.Warn(ex); } var p = participants.FirstOrDefault(); if (p != null && p.AmountBet > 0) @@ -185,11 +185,11 @@ namespace NadekoBot.Modules.Gambling var wonAmount = winner.AmountBet * (participants.Count - 1); await CurrencyHandler.AddCurrencyAsync(winner.User, "Won a Race", wonAmount, false).ConfigureAwait(false); - await raceChannel.SendMessageAsync($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race and {wonAmount}{CurrencySign}!**").ConfigureAwait(false); + await raceChannel.SendConfirmAsync($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race and {wonAmount}{CurrencySign}!**").ConfigureAwait(false); } else { - await raceChannel.SendMessageAsync($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race!**"); + await raceChannel.SendConfirmAsync($"🏁 {winner.User.Mention} as {winner.Animal} **Won the race!**"); } } @@ -218,28 +218,28 @@ namespace NadekoBot.Modules.Gambling var animal = ""; if (!animals.TryDequeue(out animal)) { - await raceChannel.SendMessageAsync($"{u.Mention} `There is no running race on this server.`"); + await raceChannel.SendErrorAsync($"{u.Mention} `There is no running race on this server.`"); return; } var p = new Participant(u, animal, amount); if (participants.Contains(p)) { - await raceChannel.SendMessageAsync($"{u.Mention} `You already joined this race.`"); + await raceChannel.SendErrorAsync($"{u.Mention} `You already joined this race.`"); return; } if (Started) { - await raceChannel.SendMessageAsync($"{u.Mention} `Race is already started`"); + await raceChannel.SendErrorAsync($"{u.Mention} `Race is already started`"); return; } if (amount > 0) if (!await CurrencyHandler.RemoveCurrencyAsync((IGuildUser)u, "BetRace", amount, true).ConfigureAwait(false)) { - try { await raceChannel.SendMessageAsync($"{u.Mention} You don't have enough {Gambling.CurrencyName}s.").ConfigureAwait(false); } catch { } + try { await raceChannel.SendErrorAsync($"{u.Mention} You don't have enough {Gambling.CurrencyName}s.").ConfigureAwait(false); } catch { } return; } participants.Add(p); - await raceChannel.SendMessageAsync($"{u.Mention} **joined the race as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {CurrencySign}!**" : "**")); + await raceChannel.SendConfirmAsync($"{u.Mention} **joined the race as a {p.Animal}" + (amount > 0 ? $" and bet {amount} {CurrencySign}!**" : "**")); } } diff --git a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs index dc075964..22d58035 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs @@ -78,7 +78,7 @@ namespace NadekoBot.Modules.Gambling arr[i] = rng.Next(1, n2 + 1) + add - sub; } var elemCnt = 0; - await channel.SendMessageAsync($"{umsg.Author.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}` +`{add}` -`{sub}`.\n`Result:` " + string.Join(", ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => elemCnt++ % 2 == 0 ? $"**{x}**" : x.ToString()))).ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}` +`{add}` -`{sub}`.\n`Result:` " + string.Join(", ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => elemCnt++ % 2 == 0 ? $"**{x}**" : x.ToString()))).ConfigureAwait(false); } } } @@ -96,7 +96,7 @@ namespace NadekoBot.Modules.Gambling if (num < 1 || num > 30) { - await channel.SendMessageAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false); + await channel.SendErrorAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false); return; } @@ -167,7 +167,7 @@ namespace NadekoBot.Modules.Gambling arr[i] = rng.Next(1, n2 + 1) + add - sub; } var elemCnt = 0; - await channel.SendMessageAsync($"{umsg.Author.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}` +`{add}` -`{sub}`.\n`Result:` " + string.Join(", ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => elemCnt++ % 2 == 0 ? $"**{x}**" : x.ToString()))).ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} rolled {n1} {(n1 == 1 ? "die" : "dice")} `1 to {n2}` +`{add}` -`{sub}`.\n`Result:` " + string.Join(", ", (ordered ? arr.OrderBy(x => x).AsEnumerable() : arr).Select(x => elemCnt++ % 2 == 0 ? $"**{x}**" : x.ToString()))).ConfigureAwait(false); } } } @@ -184,7 +184,7 @@ namespace NadekoBot.Modules.Gambling if (num < 1 || num > 30) { - await channel.SendMessageAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false); + await channel.SendErrorAsync("Invalid number specified. You can roll up to 1-30 dice at a time.").ConfigureAwait(false); return; } @@ -249,11 +249,11 @@ namespace NadekoBot.Modules.Gambling rolled = new NadekoRandom().Next(0, int.Parse(range) + 1); } - await channel.SendMessageAsync($"{umsg.Author.Mention} rolled **{rolled}**.").ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} rolled **{rolled}**.").ConfigureAwait(false); } catch (Exception ex) { - await channel.SendMessageAsync($":anger: {ex.Message}").ConfigureAwait(false); + await channel.SendErrorAsync($":anger: {ex.Message}").ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs index eca29d75..58785882 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs @@ -42,7 +42,7 @@ namespace NadekoBot.Modules.Gambling { if (cards.CardPool.Count == 0 && i != 0) { - try { await channel.SendMessageAsync("No more cards in a deck.").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } + try { await channel.SendErrorAsync("No more cards in a deck.").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); } break; } var currentCard = cards.DrawACard(); @@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Gambling return c; }); - await channel.SendMessageAsync("`Deck reshuffled.`").ConfigureAwait(false); + await channel.SendConfirmAsync("Deck reshuffled.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs index e5e84e11..7cbc089a 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs @@ -34,7 +34,7 @@ namespace NadekoBot.Modules.Gambling } if (count > 10 || count < 1) { - await channel.SendMessageAsync("`Invalid number specified. You can flip 1 to 10 coins.`"); + await channel.SendErrorAsync("`Invalid number specified. You can flip 1 to 10 coins.`"); return; } var imgs = new Image[count]; @@ -59,7 +59,7 @@ namespace NadekoBot.Modules.Gambling if (amount < 3) { - await channel.SendMessageAsync($"You can't bet less than 3{Gambling.CurrencySign}.") + await channel.SendErrorAsync($"You can't bet less than 3{Gambling.CurrencySign}.") .ConfigureAwait(false); return; } @@ -72,7 +72,7 @@ namespace NadekoBot.Modules.Gambling if (userFlowers < amount) { - await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {Gambling.CurrencyPluralName}. You only have {userFlowers}{Gambling.CurrencySign}.").ConfigureAwait(false); + await channel.SendErrorAsync($"{umsg.Author.Mention} You don't have enough {Gambling.CurrencyPluralName}. You only have {userFlowers}{Gambling.CurrencySign}.").ConfigureAwait(false); return; } diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 3dc865ca..cc4e123b 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -51,7 +51,7 @@ namespace NadekoBot.Modules.Gambling var members = role.Members().Where(u => u.Status != UserStatus.Offline && u.Status != UserStatus.Unknown); var membersArray = members as IUser[] ?? members.ToArray(); var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)]; - await channel.SendMessageAsync($"🎟 Raffled user: **{usr.Username}#{usr.Discriminator}** ID: `{usr.Id}`").ConfigureAwait(false); + await channel.SendConfirmAsync("🎟 Raffled user", $"**{usr.Username}#{usr.Discriminator}** ID: `{usr.Id}`").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -62,7 +62,7 @@ namespace NadekoBot.Modules.Gambling user = user ?? umsg.Author; - await channel.SendMessageAsync($"{user.Username} has {GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false); + await channel.SendConfirmAsync($"{user.Username} has {GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -71,7 +71,7 @@ namespace NadekoBot.Modules.Gambling { var channel = umsg.Channel; - await channel.SendMessageAsync($"`{userId}` has {GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false); + await channel.SendConfirmAsync($"`{userId}` has {GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -84,11 +84,11 @@ namespace NadekoBot.Modules.Gambling var success = await CurrencyHandler.RemoveCurrencyAsync((IGuildUser)umsg.Author, $"Gift to {receiver.Username} ({receiver.Id}).", amount, true).ConfigureAwait(false); if (!success) { - await channel.SendMessageAsync($"{umsg.Author.Mention} You don't have enough {Gambling.CurrencyPluralName}.").ConfigureAwait(false); + await channel.SendErrorAsync($"{umsg.Author.Mention} You don't have enough {Gambling.CurrencyPluralName}.").ConfigureAwait(false); return; } await CurrencyHandler.AddCurrencyAsync(receiver, $"Gift from {umsg.Author.Username} ({umsg.Author.Id}).", amount, true).ConfigureAwait(false); - await channel.SendMessageAsync($"{umsg.Author.Mention} successfully sent {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to {receiver.Mention}!").ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} successfully sent {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to {receiver.Mention}!").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -111,7 +111,7 @@ namespace NadekoBot.Modules.Gambling await CurrencyHandler.AddCurrencyAsync(usrId, $"Awarded by bot owner. ({umsg.Author.Username}/{umsg.Author.Id})", amount).ConfigureAwait(false); - await channel.SendMessageAsync($"{umsg.Author.Mention} successfully awarded {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to <@{usrId}>!").ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} successfully awarded {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to <@{usrId}>!").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -129,7 +129,7 @@ namespace NadekoBot.Modules.Gambling amount))) .ConfigureAwait(false); - await channel.SendMessageAsync($"Awarded `{amount}` {Gambling.CurrencyPluralName} to `{users.Count}` users from `{role.Name}` role.") + await channel.SendConfirmAsync($"Awarded `{amount}` {Gambling.CurrencyPluralName} to `{users.Count}` users from `{role.Name}` role.") .ConfigureAwait(false); } @@ -144,9 +144,9 @@ namespace NadekoBot.Modules.Gambling return; if(await CurrencyHandler.RemoveCurrencyAsync(user, $"Taken by bot owner.({umsg.Author.Username}/{umsg.Author.Id})", amount, true).ConfigureAwait(false)) - await channel.SendMessageAsync($"{umsg.Author.Mention} successfully took {amount} {(amount == 1? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user}!").ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} successfully took {amount} {(amount == 1? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user}!").ConfigureAwait(false); else - await channel.SendMessageAsync($"{umsg.Author.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user} because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false); + await channel.SendErrorAsync($"{umsg.Author.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from {user} because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false); } @@ -160,9 +160,9 @@ namespace NadekoBot.Modules.Gambling return; if(await CurrencyHandler.RemoveCurrencyAsync(usrId, $"Taken by bot owner.({umsg.Author.Username}/{umsg.Author.Id})", amount).ConfigureAwait(false)) - await channel.SendMessageAsync($"{umsg.Author.Mention} successfully took {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from <@{usrId}>!").ConfigureAwait(false); + await channel.SendConfirmAsync($"{umsg.Author.Mention} successfully took {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from <@{usrId}>!").ConfigureAwait(false); else - await channel.SendMessageAsync($"{umsg.Author.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from `{usrId}` because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false); + await channel.SendErrorAsync($"{umsg.Author.Mention} was unable to take {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} from `{usrId}` because the user doesn't have that much {Gambling.CurrencyPluralName}!").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -184,7 +184,7 @@ namespace NadekoBot.Modules.Gambling if (userFlowers < amount) { - await channel.SendMessageAsync($"{guildUser.Mention} You don't have enough {Gambling.CurrencyPluralName}. You only have {userFlowers}{Gambling.CurrencySign}.").ConfigureAwait(false); + await channel.SendErrorAsync($"{guildUser.Mention} You don't have enough {Gambling.CurrencyPluralName}. You only have {userFlowers}{Gambling.CurrencySign}.").ConfigureAwait(false); return; } @@ -212,7 +212,7 @@ namespace NadekoBot.Modules.Gambling await CurrencyHandler.AddCurrencyAsync(guildUser, "Betroll Gamble", amount * 10, false).ConfigureAwait(false); } - await channel.SendMessageAsync(str).ConfigureAwait(false); + await channel.SendConfirmAsync(str).ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Services/CurrencyHandler.cs b/src/NadekoBot/Services/CurrencyHandler.cs index c12dffec..45383968 100644 --- a/src/NadekoBot/Services/CurrencyHandler.cs +++ b/src/NadekoBot/Services/CurrencyHandler.cs @@ -14,7 +14,7 @@ namespace NadekoBot.Services var success = await RemoveCurrencyAsync(author.Id, reason, amount); if (success && sendMessage) - try { await author.SendMessageAsync($"`You lost:` {amount} {Gambling.CurrencySign}\n`Reason:` {reason}").ConfigureAwait(false); } catch { } + try { await author.SendErrorAsync($"`You lost:` {amount} {Gambling.CurrencySign}\n`Reason:` {reason}").ConfigureAwait(false); } catch { } return success; } @@ -47,7 +47,7 @@ namespace NadekoBot.Services await AddCurrencyAsync(author.Id, reason, amount); if (sendMessage) - try { await author.SendMessageAsync($"`You received:` {amount} {Gambling.CurrencySign}\n`Reason:` {reason}").ConfigureAwait(false); } catch { } + try { await author.SendConfirmAsync($"`You received:` {amount} {Gambling.CurrencySign}\n`Reason:` {reason}").ConfigureAwait(false); } catch { } } public static async Task AddCurrencyAsync(ulong receiverId, string reason, long amount) diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index 0b5051c7..a94681bb 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -68,6 +68,18 @@ namespace NadekoBot.Extensions public static async Task SendMessageAsync(this IGuildUser user, string message, bool isTTS = false) => await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendMessageAsync(message, isTTS).ConfigureAwait(false); + public static async Task SendConfirmAsync(this IGuildUser user, string text) + => await (await user.CreateDMChannelAsync()).SendMessageAsync("", embed: new Embed() { Description = text, Color = NadekoBot.OkColor }); + + public static async Task SendConfirmAsync(this IGuildUser user, string title, string text, string url = null) + => await(await user.CreateDMChannelAsync()).SendMessageAsync("", embed: new Embed() { Description = text, Title = title, Url = url, Color = NadekoBot.OkColor }); + + public static async Task SendErrorAsync(this IGuildUser user, string title, string error, string url = null) + => await (await user.CreateDMChannelAsync()).SendMessageAsync("", embed: new Embed() { Description = error, Title = title, Url = url, Color = NadekoBot.ErrorColor }); + + public static async Task SendErrorAsync(this IGuildUser user, string error) + => await (await user.CreateDMChannelAsync()).SendMessageAsync("", embed: new Embed() { Description = error, Color = NadekoBot.ErrorColor }); + public static async Task SendFileAsync(this IGuildUser user, string filePath, string caption = null, bool isTTS = false) => await (await user.CreateDMChannelAsync().ConfigureAwait(false)).SendFileAsync(filePath, caption, isTTS).ConfigureAwait(false);