diff --git a/NuGet.Config b/NuGet.Config index 43992254..d40268d3 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,6 +1,6 @@  - + - \ No newline at end of file + diff --git a/README.md b/README.md index f1bef229..9c9c07fd 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,11 @@ [![Discord](https://discordapp.com/api/guilds/117523346618318850/widget.png)](https://discord.gg/0ehQwTK2RBjAxzEY) [![Documentation Status](https://readthedocs.org/projects/nadekobot/badge/?version=latest)](http://nadekobot.readthedocs.io/en/1.0/?badge=latest) # NadekoBot +[![nadeko1](https://cdn.discordapp.com/attachments/155726317222887425/252095170676391936/A1.jpg)](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303) +[![nadeko2](https://cdn.discordapp.com/attachments/155726317222887425/252095207514832896/A2.jpg)](http://nadekobot.readthedocs.io/en/1.0/Commands%20List/) -## [Click here to invite Nadeko to your Discord server](https://discordapp.com/oauth2/authorize?client_id=170254782546575360&scope=bot&permissions=66186303) -## [Click here for a list of commands](http://nadekobot.readthedocs.io/en/1.0/Commands%20List/) -## INSTRUCTIONS, FAQ ---> [Wiki](http://nadekobot.readthedocs.io/en/1.0/) +##For Update, Help and Guidlines -You might want to join my discord server where i can provide help etc. https://discord.gg/0ehQwTK2RBjAxzEY +[![twitter](https://cdn.discordapp.com/attachments/155726317222887425/252107808953073664/Twitter_Logo_Blue.png)](https://twitter.com/TheNadekoBot) [![discord](https://cdn.discordapp.com/attachments/155726317222887425/252105570532720640/Discord-Logo-Color.png)](https://discord.gg/0ehQwTK2RBjAxzEY) [![Wiki](https://cdn.discordapp.com/attachments/155726317222887425/252098644390445057/read_the_docs.png)](http://nadekobot.readthedocs.io/en/1.0/) + +`Follow me on twitter for updates. | Join my Discord server if you need any help. | Read the Docs for hosting guides.` diff --git a/docs/guides/Linux Guide.md b/docs/guides/Linux Guide.md index 00be496e..8874c3d3 100644 --- a/docs/guides/Linux Guide.md +++ b/docs/guides/Linux Guide.md @@ -6,6 +6,8 @@ If you want Nadeko to play music for you 24/7 without having to hosting it on yo ####Setting up NadekoBot Assuming you have followed the link above to setup an account and Droplet with 64bit OS in Digital Ocean and got the `IP address and root password (in email)` to login, its time to get started. +**Go through this whole guide before setting up Nadeko** + #### Prerequisites - Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) - Download [CyberDuck](https://cyberduck.io) or [WinSCP](https://winscp.net/eng/download.php) @@ -24,41 +26,39 @@ If you entered your Droplets IP address correctly, it should show **login as:** ####Installing Git +![img1](https://cdn.discordapp.com/attachments/251504306010849280/251504416019054592/git.gif) + `sudo apt-get install git -y` **NOTE:** If the command is not being initiated, hit **Enter** ####Installing .NET Core SDK +![img2](https://cdn.discordapp.com/attachments/251504306010849280/251504746987388938/dotnet.gif) + Go to [this link](https://www.microsoft.com/net/core#ubuntu) provided by microsoft for instructions on how to get the most up to date version of the dotnet core sdk! Make sure that you're on the correct page for your distribution of linux as the guides are different for the various distributions -We'll go over the steps here for Ubuntu 16.04 anyway (these will **only** work on Ubuntu 16.04), accurate as of 16/10/2016 +We'll go over the steps here for Ubuntu 16.04 anyway (these will **only** work on Ubuntu 16.04), accurate as of 25/11/2016 ``` sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ xenial main" > /etc/apt/sources.list.d/dotnetdev.list' -sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893 -sudo apt-get update && sudo apt-get install dotnet-dev-1.0.0-preview2-003131 -y +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 417A0893 +sudo apt-get update && sudo apt-get install dotnet-dev-1.0.0-preview2.1-003177 -y ``` -**NOTE:** - -.NET CORE SDK only supports 64-bit Linux Operating Systems (Raspberry Pis are not supported because of this) - -If you are running Ubuntu 16.10, follow these instructions before installing .NET Core: - -- Go to [Download Page for libicu55_55.1-7_amd64.deb](http://packages.ubuntu.com/en/xenial/amd64/libicu55/download) -- Copy the link with a download option closest to you -- `wget ` (make sure it is downloaded) *e.g.* `wget http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu55_55.1-7_amd64.deb` -- Install with: `dpkg –i libicu55_55.1-7_amd64.deb` -- Now go back and install the .NET Core +**NOTE:** .NET CORE SDK only supports 64-bit Linux Operating Systems (Raspberry Pis are not supported because of this) ####Installing Opus Voice Codec and libsodium +![img3](https://cdn.discordapp.com/attachments/251504306010849280/251505294654308353/libopus.gif) + `sudo apt-get install libopus0 opus-tools libopus-dev libsodium-dev -y` ####Installing FFMPEG +![img4](https://cdn.discordapp.com/attachments/251504306010849280/251505443111829505/ffmpeg.gif) + `apt-get install ffmpeg -y` **NOTE:** If you are running **UBUNTU 14.04**, you must run these first: @@ -86,13 +86,17 @@ sudo apt-get update && sudo apt-get install ffmpeg -y ####Installing TMUX +![img5](https://cdn.discordapp.com/attachments/251504306010849280/251505519758409728/tmux.gif) + `sudo apt-get install tmux -y` ####Getting NadekoBot +![img6](https://cdn.discordapp.com/attachments/251504306010849280/251505587089571850/getting_nadeko.gif) + `cd ~ && curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh` -####Setting up and Inviting bot +####Creating and Inviting bot - Read here how to [create a DiscordBot application](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#creating-discordbot-application) - [Visual Invite Guide](http://discord.kongslien.net/guide.html) *NOTE: Client ID is your Bot ID* @@ -102,7 +106,24 @@ sudo apt-get update && sudo apt-get install ffmpeg -y - Go to the newly created link and pick the server we created, and click `Authorize`. - The bot should have been added to your server. -####Setting up NadekoBot +####Guide for Advance Users + +**Skip this step if you are a Regular User or New to Linux.** + +[![img7][img7]](http://nadekobot.readthedocs.io/en/1.0/guides/Linux%20Guide/#getting-nadekobot) + +- Right after [Getting NadekoBot](http://nadekobot.readthedocs.io/en/1.0/guides/Linux%20Guide/#getting-nadekobot) +- `cd NadekoBot/src/NadekoBot/` (go to this folder) +- `pico credentials.json` (open credentials.json to edit) +- Insert your bot's **Client ID, Bot ID** (should be same as your Client ID) **and Token** if you got it following [Creating and Inviting bot](http://nadekobot.readthedocs.io/en/1.0/guides/Linux%20Guide/#creating-and-inviting-bot). +- Insert your own ID in Owners ID follow: [Setting up credentials.json](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-credentialsjson-file) +- And Google API from [Setting up NadekoBot for Music](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-nadekobot-for-music) +- Once done, press `CTRL+X` +- It will ask for "Save Modified Buffer?", press `Y` for yes +- It will then ask "File Name to Write" (rename), just hit `Enter` and Done. +- You can now move to [Running NadekoBot](http://nadekobot.readthedocs.io/en/1.0/guides/Linux%20Guide/#running-nadekobot) + +####Setting up SFTP - Open **CyberDuck** - Click on **Open Connection** (top-left corner), a new window should appear. @@ -131,30 +152,65 @@ Once done, go back to **PuTTY** ####Running NadekoBot +![img8](https://cdn.discordapp.com/attachments/251504306010849280/251506149973557259/running_nadeko.gif) + +**Create a new Session:** + - `tmux new -s nadeko` That command will create a new session named **nadeko** *(you can replace “nadeko” with anything you prefer and remember its your session name)* so you can run the bot in background without having to keep running the PuTTY. - `cd NadekoBot/src/NadekoBot/` + +**Without Auto Restart:** + - `dotnet run --configuration Release` +**With Auto Restart:** + +- `while :; do dotnet run -c Release; sleep 5s; done` + +**NOTE:** With Auto Restart, bot will auto run if you use `.die` [command](http://nadekobot.readthedocs.io/en/1.0/Commands%20List/#administration) so you do not have to manual restart if you ever want to. +See how that happens below: + +![img9](https://cdn.discordapp.com/attachments/251504306010849280/251506312893038592/die_explaination.gif) + **Now check your Discord, the bot should be online** Now time to **move the bot to background** and to do that, press **CTRL+B+D** (this will detach the nadeko session using TMUX), and you can finally close PuTTY now. ####Some more Info (just in case) +**Info about tmux:** + - If you want to **see the sessions** after logging back again, type `tmux ls`, and that will give you the list of sessions running. - If you want to **switch to/ see that session**, type `tmux a -t nadeko` (**nadeko** is the name of the session we created before so, replace **“nadeko”** with the session name you created.) - If you want to **kill** NadekoBot **session**, type `tmux kill-session -t nadeko` -####Restarting Nadeko with the Server +**If you are running Ubuntu 16.10, and having trouble installing .NET Core:** + +- Go to [Download Page for libicu55_55.1-7_amd64.deb](http://packages.ubuntu.com/en/xenial/amd64/libicu55/download) +- Copy the link with a download option closest to you +- `wget ` *e.g.* `wget http://mirrors.kernel.org/ubuntu/pool/main/i/icu/libicu55_55.1-7_amd64.deb` (make sure it is downloaded) +- Install with: `dpkg –i libicu55_55.1-7_amd64.deb` +- Now go back and install the .NET Core + +####Restarting Nadeko + +**Restarting Nadeko with the Server:** + Open **PuTTY** and login as you have before, type `reboot` and hit Enter. +**Restarting Manually:** + +- Kill your previous session, check with `tmux ls` +- `tmux kill-session -t nadeko` (don't forget to replace "nadeko" to what ever you named your bot's session) +- Follow: [Running NadekoBot](http://nadekobot.readthedocs.io/en/1.0/guides/Linux%20Guide/#running-nadekobot) + ####Updating Nadeko -- Make sure the bot is **not** running - Connect to the terminal +- Make sure the bot is **not** running. - `cd ~ && curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh` (The same command used to install earlier) - Run the bot again as normal. @@ -173,3 +229,4 @@ cd ~/NadekoBot/discord.net/src/Discord.Net && dotnet restore && cd ../Discord.Ne cd ~/NadekoBot/discord.net && dotnet restore -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json && dotnet restore cd ~/NadekoBot/src/NadekoBot/ && dotnet restore && dotnet build --configuration Release ``` +[img7]: https://cdn.discordapp.com/attachments/251504306010849280/251505766370902016/setting_up_credentials.gif diff --git a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs index 39c1622b..dc075964 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DiceRollCommand.cs @@ -1,6 +1,6 @@ using Discord; using Discord.Commands; -using ImageProcessorCore; +using ImageSharp; using NadekoBot.Attributes; using NadekoBot.Extensions; using NadekoBot.Services; diff --git a/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs index a5a20e6e..eca29d75 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/DrawCommand.cs @@ -1,6 +1,6 @@ using Discord; using Discord.Commands; -using ImageProcessorCore; +using ImageSharp; using NadekoBot.Attributes; using NadekoBot.Extensions; using NadekoBot.Modules.Gambling.Models; diff --git a/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs b/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs index 8a85f700..0ea7bd5e 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/FlipCoinCommand.cs @@ -1,6 +1,6 @@ using Discord; using Discord.Commands; -using ImageProcessorCore; +using ImageSharp; using NadekoBot.Attributes; using NadekoBot.Extensions; using NadekoBot.Services; diff --git a/src/NadekoBot/Modules/Gambling/Gambling.cs b/src/NadekoBot/Modules/Gambling/Gambling.cs index 263f3eb7..948bfd82 100644 --- a/src/NadekoBot/Modules/Gambling/Gambling.cs +++ b/src/NadekoBot/Modules/Gambling/Gambling.cs @@ -9,6 +9,7 @@ using NadekoBot.Services; using Discord.WebSocket; using NadekoBot.Services.Database.Models; using System.Collections.Generic; +using NadekoBot.Services.Database; namespace NadekoBot.Modules.Gambling { @@ -31,6 +32,14 @@ namespace NadekoBot.Modules.Gambling } } + public static long GetCurrency(ulong id) + { + using (var uow = DbHandler.UnitOfWork()) + { + return uow.Currency.GetUserCurrency(id); + } + } + [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task Raffle(IUserMessage umsg, [Remainder] IRole role = null) @@ -52,15 +61,8 @@ namespace NadekoBot.Modules.Gambling var channel = umsg.Channel; user = user ?? umsg.Author; - long amount; - BotConfig config; - using (var uow = DbHandler.UnitOfWork()) - { - amount = uow.Currency.GetUserCurrency(user.Id); - config = uow.BotConfig.GetOrCreate(); - } - await channel.SendMessageAsync($"{user.Username} has {amount} {config.CurrencySign}").ConfigureAwait(false); + await channel.SendMessageAsync($"{user.Username} has {GetCurrency(user.Id)} {CurrencySign}").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -69,15 +71,7 @@ namespace NadekoBot.Modules.Gambling { var channel = umsg.Channel; - long amount; - BotConfig config; - using (var uow = DbHandler.UnitOfWork()) - { - amount = uow.Currency.GetUserCurrency(userId); - config = uow.BotConfig.GetOrCreate(); - } - - await channel.SendMessageAsync($"`{userId}` has {amount} {config.CurrencySign}").ConfigureAwait(false); + await channel.SendMessageAsync($"`{userId}` has {GetCurrency(userId)} {CurrencySign}").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Modules/Games/Games.cs b/src/NadekoBot/Modules/Games/Games.cs index c61a305c..115fdb94 100644 --- a/src/NadekoBot/Modules/Games/Games.cs +++ b/src/NadekoBot/Modules/Games/Games.cs @@ -48,7 +48,7 @@ namespace NadekoBot.Modules.Games if (string.IsNullOrWhiteSpace(question)) return; var rng = new NadekoRandom(); - await channel.SendMessageAsync($@":question: `Question` __**{question}**__ + await channel.SendMessageAsync($@"❓ `Question` __**{question}**__ 🎱 `8Ball Answers` __**{_8BallResponses.Shuffle().FirstOrDefault()}**__").ConfigureAwait(false); } @@ -61,11 +61,11 @@ namespace NadekoBot.Modules.Games Func GetRPSPick = (p) => { if (p == 0) - return "rocket"; + return "🚀"; else if (p == 1) - return "paperclip"; + return "📎"; else - return "scissors"; + return "✂️"; }; int pick; @@ -91,13 +91,13 @@ namespace NadekoBot.Modules.Games var nadekoPick = new NadekoRandom().Next(0, 3); var msg = ""; if (pick == nadekoPick) - msg = $"It's a draw! Both picked :{GetRPSPick(pick)}:"; + msg = $"It's a draw! Both picked {GetRPSPick(pick)}"; else if ((pick == 0 && nadekoPick == 1) || (pick == 1 && nadekoPick == 2) || (pick == 2 && nadekoPick == 0)) - msg = $"{NadekoBot.Client.GetCurrentUser().Mention} won! :{GetRPSPick(nadekoPick)}: beats :{GetRPSPick(pick)}:"; + msg = $"{NadekoBot.Client.GetCurrentUser().Mention} won! {GetRPSPick(nadekoPick)} beats {GetRPSPick(pick)}"; else - msg = $"{umsg.Author.Mention} won! :{GetRPSPick(pick)}: beats :{GetRPSPick(nadekoPick)}:"; + msg = $"{umsg.Author.Mention} won! {GetRPSPick(pick)} beats {GetRPSPick(nadekoPick)}"; await channel.SendMessageAsync(msg).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Permissions/Commands/CmdCdsCommands.cs b/src/NadekoBot/Modules/Permissions/Commands/CmdCdsCommands.cs index 149c0e4f..28e3ec40 100644 --- a/src/NadekoBot/Modules/Permissions/Commands/CmdCdsCommands.cs +++ b/src/NadekoBot/Modules/Permissions/Commands/CmdCdsCommands.cs @@ -40,7 +40,7 @@ namespace NadekoBot.Modules.Permissions var channel = (ITextChannel)imsg.Channel; if (secs < 0 || secs > 3600) { - await channel.SendMessageAsync("Invalid second parameter. (Must be a number between 0 and 3600)").ConfigureAwait(false); + await channel.SendMessageAsync("⚠️ Invalid second parameter. (Must be a number between 0 and 3600)").ConfigureAwait(false); return; } @@ -67,10 +67,10 @@ namespace NadekoBot.Modules.Permissions { var activeCds = activeCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet()); activeCds.RemoveWhere(ac => ac.Command == command.Text.ToLowerInvariant()); - await channel.SendMessageAsync($"Command **{command}** has no coooldown now and all existing cooldowns have been cleared.").ConfigureAwait(false); + await channel.SendMessageAsync($"🚮 Command **{command}** has no coooldown now and all existing cooldowns have been cleared.").ConfigureAwait(false); } else - await channel.SendMessageAsync($"Command **{command}** now has a **{secs} {(secs == 1 ? "second" : "seconds")}** cooldown.").ConfigureAwait(false); + await channel.SendMessageAsync($"✅ Command **{command}** now has a **{secs} {(secs == 1 ? "second" : "seconds")}** cooldown.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -81,7 +81,7 @@ namespace NadekoBot.Modules.Permissions var localSet = commandCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet()); if (!localSet.Any()) - await channel.SendMessageAsync("`No command cooldowns set.`").ConfigureAwait(false); + await channel.SendMessageAsync("ℹ️ `No command cooldowns set.`").ConfigureAwait(false); else await channel.SendTableAsync("", localSet.Select(c => c.CommandName + ": " + c.Seconds + " secs"), s => $"{s,-30}", 2).ConfigureAwait(false); } diff --git a/src/NadekoBot/Modules/Permissions/Commands/FilterCommands.cs b/src/NadekoBot/Modules/Permissions/Commands/FilterCommands.cs index bb6ddbab..c1e35d2d 100644 --- a/src/NadekoBot/Modules/Permissions/Commands/FilterCommands.cs +++ b/src/NadekoBot/Modules/Permissions/Commands/FilterCommands.cs @@ -76,12 +76,12 @@ namespace NadekoBot.Modules.Permissions if (enabled) { InviteFilteringServers.Add(channel.Guild.Id); - await channel.SendMessageAsync("`Invite filtering enabled on this server.`").ConfigureAwait(false); + await channel.SendMessageAsync("✅ `Invite filtering enabled on this server.`").ConfigureAwait(false); } else { InviteFilteringServers.TryRemove(channel.Guild.Id); - await channel.SendMessageAsync("`Invite filtering disabled on this server.`").ConfigureAwait(false); + await channel.SendMessageAsync("ℹ️ `Invite filtering disabled on this server.`").ConfigureAwait(false); } } @@ -109,12 +109,12 @@ namespace NadekoBot.Modules.Permissions if (removed == 0) { InviteFilteringChannels.Add(channel.Id); - await channel.SendMessageAsync("`Invite filtering enabled on this channel.`").ConfigureAwait(false); + await channel.SendMessageAsync("✅ `Invite filtering enabled on this channel.`").ConfigureAwait(false); } else { InviteFilteringChannels.TryRemove(channel.Id); - await channel.SendMessageAsync("`Invite filtering disabled on this channel.`").ConfigureAwait(false); + await channel.SendMessageAsync("ℹ️ `Invite filtering disabled on this channel.`").ConfigureAwait(false); } } @@ -135,12 +135,12 @@ namespace NadekoBot.Modules.Permissions if (enabled) { WordFilteringServers.Add(channel.Guild.Id); - await channel.SendMessageAsync("`Word filtering enabled on this server.`").ConfigureAwait(false); + await channel.SendMessageAsync("✅ `Word filtering enabled on this server.`").ConfigureAwait(false); } else { WordFilteringServers.TryRemove(channel.Guild.Id); - await channel.SendMessageAsync("`Word filtering disabled on this server.`").ConfigureAwait(false); + await channel.SendMessageAsync("ℹ️ `Word filtering disabled on this server.`").ConfigureAwait(false); } } @@ -168,12 +168,12 @@ namespace NadekoBot.Modules.Permissions if (removed == 0) { WordFilteringChannels.Add(channel.Id); - await channel.SendMessageAsync("`Word filtering enabled on this channel.`").ConfigureAwait(false); + await channel.SendMessageAsync("✅ `Word filtering enabled on this channel.`").ConfigureAwait(false); } else { WordFilteringChannels.TryRemove(channel.Id); - await channel.SendMessageAsync("`Word filtering disabled on this channel.`").ConfigureAwait(false); + await channel.SendMessageAsync("ℹ️ `Word filtering disabled on this channel.`").ConfigureAwait(false); } } @@ -206,13 +206,13 @@ namespace NadekoBot.Modules.Permissions if (removed == 0) { filteredWords.Add(word); - await channel.SendMessageAsync($"Word `{word}` successfully added to the list of filtered words.") + await channel.SendMessageAsync($"✅ Word `{word}` successfully added to the list of filtered words.") .ConfigureAwait(false); } else { filteredWords.TryRemove(word); - await channel.SendMessageAsync($"Word `{word}` removed from the list of filtered words.") + await channel.SendMessageAsync($"ℹ️ Word `{word}` removed from the list of filtered words.") .ConfigureAwait(false); } } @@ -226,7 +226,7 @@ namespace NadekoBot.Modules.Permissions ConcurrentHashSet filteredWords; ServerFilteredWords.TryGetValue(channel.Guild.Id, out filteredWords); - await channel.SendMessageAsync($"`List of banned words:`\n" + string.Join(",\n", filteredWords)) + await channel.SendMessageAsync($"ℹ️ `List of banned words:`\n" + string.Join(",\n", filteredWords)) .ConfigureAwait(false); } } diff --git a/src/NadekoBot/Modules/Permissions/Permissions.cs b/src/NadekoBot/Modules/Permissions/Permissions.cs index 1edd21ce..6b624257 100644 --- a/src/NadekoBot/Modules/Permissions/Permissions.cs +++ b/src/NadekoBot/Modules/Permissions/Permissions.cs @@ -62,7 +62,7 @@ namespace NadekoBot.Modules.Permissions await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync("I will " + (action.Value ? "now" : "no longer") + " show permission warnings.").ConfigureAwait(false); + await channel.SendMessageAsync("ℹ️ I will " + (action.Value ? "now" : "no longer") + " show permission warnings.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -75,7 +75,7 @@ namespace NadekoBot.Modules.Permissions var config = uow.GuildConfigs.For(channel.Guild.Id); if (role == null) { - await channel.SendMessageAsync($"Current permission role is **{config.PermissionRole}**.").ConfigureAwait(false); + await channel.SendMessageAsync($"ℹ️ Current permission role is **{config.PermissionRole}**.").ConfigureAwait(false); return; } else { @@ -90,7 +90,7 @@ namespace NadekoBot.Modules.Permissions } } - await channel.SendMessageAsync($"Users now require **{role.Name}** role in order to edit permissions.").ConfigureAwait(false); + await channel.SendMessageAsync($"✅ Users now require **{role.Name}** role in order to edit permissions.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -106,11 +106,11 @@ namespace NadekoBot.Modules.Permissions { var perms = uow.GuildConfigs.PermissionsFor(channel.Guild.Id).RootPermission; var i = 1 + 20 * (page - 1); - toSend = Format.Code($"Permissions page {page}") + "\n\n" + String.Join("\n", perms.AsEnumerable().Skip((page - 1) * 20).Take(20).Select(p => $"`{(i++)}.` {(p.Next == null ? Format.Bold(p.GetCommand(channel.Guild) + " [uneditable]") : (p.GetCommand(channel.Guild)))}")); + toSend = Format.Code($"📄 Permissions page {page}") + "\n\n" + String.Join("\n", perms.AsEnumerable().Skip((page - 1) * 20).Take(20).Select(p => $"`{(i++)}.` {(p.Next == null ? Format.Bold(p.GetCommand(channel.Guild) + " [uneditable]") : (p.GetCommand(channel.Guild)))}")); } if (string.IsNullOrWhiteSpace(toSend)) - await channel.SendMessageAsync("`No permissions set.`").ConfigureAwait(false); + await channel.SendMessageAsync("❗️`No permissions set.`").ConfigureAwait(false); else await channel.SendMessageAsync(toSend).ConfigureAwait(false); } @@ -156,11 +156,11 @@ namespace NadekoBot.Modules.Permissions uow2._context.SaveChanges(); } - await channel.SendMessageAsync($"{imsg.Author.Mention} removed permission **{p.GetCommand(channel.Guild)}** from position #{index + 1}.").ConfigureAwait(false); + await channel.SendMessageAsync($"✅ {imsg.Author.Mention} removed permission **{p.GetCommand(channel.Guild)}** from position #{index + 1}.").ConfigureAwait(false); } catch (ArgumentOutOfRangeException) { - await channel.SendMessageAsync("`No command on that index found.`").ConfigureAwait(false); + await channel.SendMessageAsync("❗️`No command on that index found.`").ConfigureAwait(false); } } @@ -208,13 +208,13 @@ namespace NadekoBot.Modules.Permissions { if (!fromFound) { - await channel.SendMessageAsync($"`Can't find permission at index `#{++from}`").ConfigureAwait(false); + await channel.SendMessageAsync($"❗️`Can't find permission at index `#{++from}`").ConfigureAwait(false); return; } if (!toFound) { - await channel.SendMessageAsync($"`Can't find permission at index `#{++to}`").ConfigureAwait(false); + await channel.SendMessageAsync($"❗️`Can't find permission at index `#{++to}`").ConfigureAwait(false); return; } } @@ -264,7 +264,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"`Moved permission:` \"{fromPerm.GetCommand(channel.Guild)}\" `from #{++from} to #{++to}.`").ConfigureAwait(false); + await channel.SendMessageAsync($"✅ `Moved permission:` \"{fromPerm.GetCommand(channel.Guild)}\" `from #{++from} to #{++to}.`").ConfigureAwait(false); return; } catch (Exception e) when (e is ArgumentOutOfRangeException || e is IndexOutOfRangeException) @@ -300,7 +300,7 @@ namespace NadekoBot.Modules.Permissions await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command on this server.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{command.Text}` command on this server.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -328,7 +328,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module on this server.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of **`{module.Name}`** module on this server.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -356,7 +356,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command for `{user}` user.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{command.Text}` command for `{user}` user.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -384,7 +384,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module for `{user}` user.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{module.Name}` module for `{user}` user.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -412,7 +412,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command for `{role}` role.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{command.Text}` command for `{role}` role.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -440,7 +440,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module for `{role}` role.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{module.Name}` module for `{role}` role.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -473,7 +473,7 @@ namespace NadekoBot.Modules.Permissions catch (Exception ex) { Console.WriteLine(ex); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{command.Text}` command for `{chnl}` channel.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{command.Text}` command for `{chnl}` channel.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -501,7 +501,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `{module.Name}` module for `{chnl}` channel.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `{module.Name}` module for `{chnl}` channel.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -529,7 +529,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` for `{chnl}` channel.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `ALL MODULES` for `{chnl}` channel.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -557,7 +557,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` for `{role}` role.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `ALL MODULES` for `{role}` role.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -585,7 +585,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` for `{user}` user.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `ALL MODULES` for `{user}` user.").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] @@ -624,7 +624,7 @@ namespace NadekoBot.Modules.Permissions }, (id, old) => { old.RootPermission = config.RootPermission; return old; }); await uow.CompleteAsync().ConfigureAwait(false); } - await channel.SendMessageAsync($"{(action.Value ? "Allowed" : "Denied")} usage of `ALL MODULES` on this server.").ConfigureAwait(false); + await channel.SendMessageAsync($"{(action.Value ? "✅ Allowed" : "🆗 Denied")} usage of `ALL MODULES` on this server.").ConfigureAwait(false); } } } diff --git a/src/NadekoBot/Modules/Searches/Searches.cs b/src/NadekoBot/Modules/Searches/Searches.cs index b460d08a..47429830 100644 --- a/src/NadekoBot/Modules/Searches/Searches.cs +++ b/src/NadekoBot/Modules/Searches/Searches.cs @@ -13,7 +13,7 @@ using System.Text.RegularExpressions; using System.Net; using NadekoBot.Modules.Searches.Models; using System.Collections.Generic; -using ImageProcessorCore; +using ImageSharp; using NadekoBot.Extensions; using System.IO; using NadekoBot.Modules.Searches.Commands.OMDB; @@ -434,7 +434,7 @@ $@"🌍 **Weather for** 【{obj["target"]}】 var green = Convert.ToInt32(color.Substring(2, 2), 16); var blue = Convert.ToInt32(color.Substring(4, 2), 16); - img.BackgroundColor(new ImageProcessorCore.Color(color)); + img.BackgroundColor(new ImageSharp.Color(color)); await channel.SendFileAsync(img.ToStream(), $"{color}.png"); } diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 17885f24..3e191577 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -193,7 +193,7 @@ namespace NadekoBot.Modules.Utility return; } - await channel.SendMessageAsync(String.Join("\n", guilds.Select(g => $"```css\n Name: {g.Name} ID: {g.Id} Members: #{g.GetUsers().Count} OwnerID:{g.OwnerId} ```"))).ConfigureAwait(false); + await channel.SendMessageAsync(String.Join("\n", guilds.Select(g => $"```css\nName: {g.Name} ID:{g.Id} Members:#{g.GetUsers().Count} OwnerID: {g.OwnerId} ```"))).ConfigureAwait(false); } //[NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/NadekoBot/Services/CommandHandler.cs index 73679395..08aa6fbd 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/NadekoBot/Services/CommandHandler.cs @@ -185,7 +185,7 @@ namespace NadekoBot.Services if (guild != null && command != null && result.Error == CommandError.Exception) { if (permCache != null && permCache.Verbose) - try { await msg.Channel.SendMessageAsync(":warning: " + result.ErrorReason).ConfigureAwait(false); } catch { } + try { await msg.Channel.SendMessageAsync("⚠️ " + result.ErrorReason).ConfigureAwait(false); } catch { } } } else diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index 04159315..166e41b0 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -1,6 +1,6 @@ using Discord; using Discord.WebSocket; -using ImageProcessorCore; +using ImageSharp; using Newtonsoft.Json; using System; using System.Collections.Concurrent; diff --git a/src/NadekoBot/project.json b/src/NadekoBot/project.json index 7017f62b..b5fd1cbb 100644 --- a/src/NadekoBot/project.json +++ b/src/NadekoBot/project.json @@ -27,7 +27,7 @@ }, "Google.Apis.Urlshortener.v1": "1.19.0.138", "Google.Apis.YouTube.v3": "1.19.0.655", - "ImageProcessorCore": "1.0.0-alpha1095", + "ImageSharp": "1.0.0-alpha-000079", "Microsoft.EntityFrameworkCore": "1.1.0", "Microsoft.EntityFrameworkCore.Design": "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite": "1.1.0", @@ -47,7 +47,8 @@ "System.Xml.XPath": "4.3.0" }, "tools": { - "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final" + "Microsoft.EntityFrameworkCore.Tools.DotNet": "1.1.0-preview4-final", + "Microsoft.DotNet.Watcher.Tools": "1.1.0-preview4-final" }, "frameworks": { "netcoreapp1.0": {