From cf1a3899d1f1a2c6372308046925484058de9a07 Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sat, 22 Oct 2016 05:56:13 +0100 Subject: [PATCH 1/6] 1.0 --- .../Modules/Administration/Administration.cs | 16 ++++++++++- .../Modules/Utility/Commands/InfoCommands.cs | 7 ++--- .../Resources/CommandStrings.Designer.cs | 27 +++++++++++++++++++ src/NadekoBot/Resources/CommandStrings.resx | 9 +++++++ 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Administration.cs b/src/NadekoBot/Modules/Administration/Administration.cs index b2d7333f..8f123251 100644 --- a/src/NadekoBot/Modules/Administration/Administration.cs +++ b/src/NadekoBot/Modules/Administration/Administration.cs @@ -689,7 +689,21 @@ namespace NadekoBot.Modules.Administration await NadekoBot.Client.GetCurrentUser().ModifyStatusAsync(u => u.Game = new Game(game)).ConfigureAwait(false); - await channel.SendMessageAsync("New game set.").ConfigureAwait(false); + await channel.SendMessageAsync("`New game set.`").ConfigureAwait(false); + } + + [NadekoCommand, Usage, Description, Aliases] + [RequireContext(ContextType.Guild)] + [OwnerOnly] + public async Task SetStream(IUserMessage umsg, string url, [Remainder] string name = null) + { + var channel = (ITextChannel)umsg.Channel; + + name = name ?? ""; + + await NadekoBot.Client.GetCurrentUser().ModifyStatusAsync(u => u.Game = new Game(name, url, StreamType.Twitch)).ConfigureAwait(false); + + await channel.SendMessageAsync("`New stream set.`").ConfigureAwait(false); } [NadekoCommand, Usage, Description, Aliases] diff --git a/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs b/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs index 1cfc36a5..fad77cc4 100644 --- a/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs +++ b/src/NadekoBot/Modules/Utility/Commands/InfoCommands.cs @@ -36,7 +36,7 @@ namespace NadekoBot.Modules.Utility `TextChannels:` **{(await server.GetTextChannelsAsync()).Count()}** `VoiceChannels:` **{(await server.GetVoiceChannelsAsync()).Count()}** `Members:` **{users.Count}** `-` {users.Count(u => u.Status == UserStatus.Online)}:green_heart: {users.Count(u => u.Status == UserStatus.Idle)}:yellow_heart: {users.Count(u => u.Status == UserStatus.DoNotDisturb)}:heart: {users.Count(u=> u.Status == UserStatus.Offline || u.Status == UserStatus.Unknown)}:black_heart: `Roles:` **{server.Roles.Count()}** -`Created At:` **{createdAt}** +`Created At:` **{createdAt.ToString("dd.MM.yyyy HH:mm")}** "); if (server.Emojis.Count() > 0) sb.AppendLine($"`Custom Emojis:` **{string.Join(", ", server.Emojis)}**"); @@ -57,7 +57,7 @@ namespace NadekoBot.Modules.Utility var createdAt = new DateTime(2015, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ch.Id >> 22); var toReturn = $@"`Name:` **#{ch.Name}** `Id:` **{ch.Id}** -`Created At:` **{createdAt}** +`Created At:` **{createdAt.ToString("dd.MM.yyyy HH:mm")}** `Topic:` **{ch.Topic}** `Users:` **{(await ch.GetUsersAsync()).Count()}**"; await msg.Reply(toReturn).ConfigureAwait(false); @@ -76,7 +76,8 @@ namespace NadekoBot.Modules.Utility toReturn += $"`Nickname:` **{user.Nickname}**"; toReturn += $@"`Id:` **{user.Id}** `Current Game:` **{(user.Game?.Name == null ? "-" : user.Game.Name)}** -`Joined At:` **{user.JoinedAt}** +`Joined Server:` **{user.JoinedAt?.ToString("dd.MM.yyyy HH:mm")}** +`Joined Discord:` **{user.CreatedAt.ToString("dd.MM.yyyy HH:mm")}** `Roles:` **({user.Roles.Count()}) - {string.Join(", ", user.Roles.Select(r => r.Name)).SanitizeMentions()}** `AvatarUrl:` **{user.AvatarUrl}**"; await msg.Reply(toReturn).ConfigureAwait(false); diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index b8e071e5..d88c31c4 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -5729,6 +5729,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to setstream. + /// + public static string setstream_cmd { + get { + return ResourceManager.GetString("setstream_cmd", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sets the bots stream. First argument is the twitch link, second argument is stream name.. + /// + public static string setstream_desc { + get { + return ResourceManager.GetString("setstream_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `{0}setstream https://www.twitch.tv/masterkwoth Developing Nakedo`. + /// + public static string setstream_usage { + get { + return ResourceManager.GetString("setstream_usage", resourceCulture); + } + } + /// /// Looks up a localized string similar to settopic st. /// diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 60e1b125..e8016c21 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -2475,4 +2475,13 @@ `{0}adsarm` + + setstream + + + Sets the bots stream. First argument is the twitch link, second argument is stream name. + + + `{0}setstream https://www.twitch.tv/masterkwoth Developing Nakedo` + From fc15f95fcbf288482d9a83bca6e92b002962cab4 Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sat, 22 Oct 2016 09:05:42 +0100 Subject: [PATCH 2/6] Minor Guide Updates - Less saving of `credentials.json` required - Only needing to use `credentials_example.json` if you fuck up accounted for - Restore and build in one swift move accounted for --- docs/guides/Linux Guide.md | 32 ++++++++++++----------------- docs/guides/OSX Guide.md | 40 +++++++++++++++--------------------- docs/guides/Windows Guide.md | 32 ++++++++++++++--------------- 3 files changed, 45 insertions(+), 59 deletions(-) diff --git a/docs/guides/Linux Guide.md b/docs/guides/Linux Guide.md index f32f39f1..87775703 100644 --- a/docs/guides/Linux Guide.md +++ b/docs/guides/Linux Guide.md @@ -97,17 +97,12 @@ sudo apt-get update && sudo apt-get install ffmpeg -y` ####Getting NadekoBot **10)** -`git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git` +`cd ~ && git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git` ####Building NadekoBot -**11)** `cd /NadekoBot/discord.net/src/Discord.Net` -`dotnet restore && dotnet build --configuration Release` -**12)** -`cd ../Discord.Net.Commands/ && dotnet restore && dotnet build --configuration Release` - -**13)** -`cd ../../../src/NadekoBot/ && dotnet restore && dotnet build --configuration Release` +**11)** +`cd ~/NadekoBot/ && dotnet restore && cd ~/NadekoBot/src/NadekoBot/ && dotnet build --configuration Release` ####Setting up NadekoBot @@ -120,29 +115,28 @@ sudo apt-get update && sudo apt-get install ffmpeg -y` - In **Password:** type `the new root password (you changed at the start)` - Click on **Connect** - It should show you the NadekoBot folder which was created by git earlier -- Open that folder, then open the `src` folder, followed by another `NadekoBot` folder and you should see `credentials_example.json` here +- Open that folder, then open the `src` folder, followed by another `NadekoBot` folder and you should see `credentials.json` here -####Renaming Credentials.json +####Setting up credentials.json -- Copy the `credentials_example.json` to desktop -- EDIT it as it is guided here: [Setting up Credentials.json](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-credentialsjson-file) -- Read here how to [create a DiscordBot application](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#creating-discordbot-application) -- Rename it to `credentials.json` and paste/put it back in the folder. `(Yes, using CyberDuck)` -- You should see two files `credentials_example.json` and `credentials.json` -- Also if you already have nadeko setup and have `credentials.json` and `NadekoBot.db`, you can just copy and paste the `credentials.json` to `NadekoBot/src/NadekoBot` and `NadekoBot.db` to `NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.0/data` using CyberDuck. +- Copy the `credentials.json` to desktop +- EDIT it as it is guided here: [Setting up credentials.json](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-credentialsjson-file) +- Read here how to [create a DiscordBot application.](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#creating-discordbot-application) +- Paste/put it back in the folder once done. `(Yes, using CyberDuck)` +- If you already have nadeko setup and have `credentials.json` and `NadekoBot.db`, you can just copy and paste the `credentials.json` to `NadekoBot/src/NadekoBot` and `NadekoBot.db` to `NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.0/data` using CyberDuck. ####Running NadekoBot Go back to **PuTTY**, `(hope its still running xD)` -**14)** +**12)** Type/ Copy and hit **Enter**. `tmux new -s nadeko` `cd NadekoBot/src/NadekoBot/` **^this 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 PuTTY in the background. -**15)** +**13)** `dotnet run --configuration Release` **CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING** @@ -171,7 +165,7 @@ Open **PuTTY** and login as you have before, type `reboot` and hit Enter. - Make sure the bot is **not** running - Connect to the terminal -- `cd NadekoBot` +- `cd ~\NadekoBot\` - `git init && git pull` - Run the bot again as normal, and you've updated! diff --git a/docs/guides/OSX Guide.md b/docs/guides/OSX Guide.md index 1d1fade9..a13f0b9f 100644 --- a/docs/guides/OSX Guide.md +++ b/docs/guides/OSX Guide.md @@ -9,7 +9,8 @@ `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"` -Run `brew update` to fetch the latest package data. +Run `brew update` to fetch the latest package data. + ####Installing dependencies ``` brew install git @@ -28,7 +29,7 @@ brew install tmux - `ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/` - `ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/` - Download the .NET Core SDK, found [here.](https://go.microsoft.com/fwlink/?LinkID=827526) -- Open the `.pkg` and install it. +- Open the `.pkg` file you downloaded and install it. ####Check your `FFMPEG` @@ -51,14 +52,10 @@ A dialog box will open asking if you want to install `xcode-select`. Select inst ####Downloading and building Nadeko - `cd ~` - `git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git` -- `cd /NadekoBot/discord.net/src/Discord.Net` -- `dotnet restore && dotnet build --configuration Release` -- `cd ../Discord.Net.Commands/` -- `dotnet restore && dotnet build --configuration Release` -- `cd ../../../src/NadekoBot/` -- `dotnet restore && dotnet build --configuration Release` -- `dotnet run --configuration Release` -- The above step **will** crash, giving you an error, which will say that `credentials_example.json` has been generated, we'll use this soon +- `cd ~/NadekoBot/` +- `dotnet restore` +- `cd ~/NadekoBot/src/NadekoBot/` +- `dotnet build --configuration Release` ####Creating DiscordBot application - Go to [the Discord developer application page.][DiscordApp] @@ -71,14 +68,18 @@ A dialog box will open asking if you want to install `xcode-select`. Select inst ####Setting up Credentials.json file - Open up the `NadekoBot` folder, which should be in your home directory, then the `src` folder and then the additonal `NadekoBot` folder. -- In our `NadekoBot` folder you should have `.json` file named `credentials_example.json`. (Note: If you do not see a **.json** after `credentials_example.json `, do not add the `**.json**`. You most likely have `"Hide file extensions"` enabled.) -- Rename `credentials_example.json` to `credentials.json`. +- In our `NadekoBot` folder you should have `.json` file named `credentials.json`. (Note: If you do not see a **.json** after `credentials.json `, do not add the `**.json**`. You most likely have `"Hide file extensions"` enabled.) +- If you mess up the setup of `credentials.json`, rename `credentials_example.json` to `credentials.json`. - Open the file with your Text editor. - In your [applications page][DiscordApp] (the window you were asked to keep open earlier), under the `Bot User` section, you will see `Token:click to reveal`, click to reveal the token. - Copy your bot's token, and on the `"Token"` line of your `credentials.json`, replace `null` with your bot token and put quotation marks before and after the token, like so `"Example.Token"` - Copy the `Client ID` on the page and replace the null part of the `ClientId` line with it, and put quotation marks before and after, like earlier. - Again, copy the same `Client ID` and replace the null part of the `BotId` line with it, and do **not** put quotation marks before and after the ID. -- Save your `credentials.json` but keep it open. We need to add your `User ID` as one of the `OwnerIds` shortly. +- Go to a server on discord and attempt to mention yourself, but put a backslash at the start as shown below +- So the message `\@fearnlj01#3535` will appears as `<@145521851676884992>` after you send the message (to make it slightly easier, add the backslash after you type the mention out) +- Copy the numbers from the message you sent (`145521851676884992`) and replace the `0` on the `OwnerIds` section with your user ID shown earlier. +- Save `credentials.json` (make sure you aren't saving it as `credentials.json.txt`) +- If done correctly, you are now the bot owner. You can add multiple owners by seperating each owner ID with a comma within the square brackets. ####Running NadekoBot @@ -113,16 +114,7 @@ Now time to move bot to background and to do that, press CTRL+B+D (this will dit - Your edited link should look like this: `https://discordapp.com/oauth2/authorize?client_id=**YOUR_CLENT_ID**&scope=bot&permissions=66186303`. - Go to newly created link and pick the server we created, and click `Authorize`. - Bot should be added to your server. - -####Setting up OwnerIds -- In the server where your bot is, in a text channel, type `.uid` -- Your `User ID` should show, copy it. -- Stop NadekoBot from running by presing `Ctrl + C` in the terminal that the bot is running in -- Replace the `null` section on the `OwnerIds` line with your user ID shown earlier and put a square bracket around each end of the ID like so, `[105635576866156544]` -- Run Nadeko again, as guided above. -- If done correctly, you are now the bot owner. -- You can add multiple owner IDs by seperating them with a comma within the square brackets. - + ####Setting NadekoBot Music For Music Setup and API keys check [Setting up NadekoBot for Music](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-nadekobot-for-music) and [JSON Explanations](http://nadekobot.readthedocs.io/en/1.0/JSON%20Explanations/). @@ -150,4 +142,4 @@ Nadeko is really easy to update as of version 1.0! just copy and paste the comma [Atom]: https://atom.io/ [Invite Guide]: http://discord.kongslien.net/guide.html [Google Console]: https://console.developers.google.com -[Soundcloud]: https://soundcloud.com/you/apps/new +[Soundcloud]: https://soundcloud.com/you/apps/new \ No newline at end of file diff --git a/docs/guides/Windows Guide.md b/docs/guides/Windows Guide.md index 1cb54cd9..6bfdb01f 100644 --- a/docs/guides/Windows Guide.md +++ b/docs/guides/Windows Guide.md @@ -16,10 +16,10 @@ ________________________________________________________________________________ ####Guide - Make sure you have installed both [Git][Git] and the [.NET Core SDK][.NET Core SDK]. - Create a folder somewhere and name it `Nadeko`. -- Head to the [Windows Installer releases page][WinInstaller] and download the latest source code zip. +- Head to the [Windows Installer releases page][WinInstaller] and download the latest release zip. - Extract the contents of the zip you just downloaded to the `Nadeko` folder that we created earlier. -- You will see a few files, most importantly, `NadekoInstaller.bat ` after extraction (You may not see the `.bat` part of the filename). -- Run/Launch/Open `NadekoInstaller.bat ` and you will see it running in the command prompt. +- You will see two files, most importantly, `NadekoInstaller.bat` after extraction (You may not see the `.bat` part of the filename). +- Run/Launch/Open `NadekoInstaller.bat` and you will see it running in the command prompt. - Wait a while for the file to finish installing, it'll say when it's done in the command prompt. - You should now have a new folder named `NadekoBot` inside the `Nadeko` folder we previously created. - You can safely delete the `NadekoInstall_Temp` folder if you so choose. @@ -33,16 +33,20 @@ ________________________________________________________________________________ - Click on `Create a Bot User` and confirm that you do want to add a bot to this app. - Keep this window open for now. -####Setting up Credentials.json file -- In our `NadekoBot` folder you should see a `src` folder, then *another* `NadekoBot` folder, in this final folder, you should see a `.json` file named `credentials_example.json`. (Note: If you do not see a **.json** after `credentials_example.json `, do not add the `**.json**`. You most likely have `"Hide file extensions"` enabled.) -- Rename `credentials_example.json` to `credentials.json`. +####Setting up credentials.json file +- In our `NadekoBot` folder you should see a `src` folder, then *another* `NadekoBot` folder, in this final folder, you should see a `.json` file named `credentials.json`. (Note: If you do not see a **.json** after `credentials.json `, do not add the `**.json**`. You most likely have `"Hide file extensions"` enabled.) +- If you mess up the setup of `credentials.json`, rename `credentials_example.json` to `credentials.json`. - Open the file with [Notepad++][Notepad++]. - In there you will see fields such as `Token`, `ClientId`, `BotId` and `OwnerIDs`. - In your [applications page][DiscordApp] (the window you were asked to keep open earlier), under the `Bot User` section, you will see `Token:click to reveal`, click to reveal the token. - Copy your bot's token, and on the `"Token"` line of your `credentials.json`, paste your bot token between the quotation marks. - Copy the `Client ID` on the page and replace the `12312123` part of the `ClientId` line with it. - Again, copy the same `Client ID` and replace the `null` part of the `BotId` line with it. -- Save your `credentials.json` but keep it open. We need to add your `User ID` as one of the `OwnerIds` shortly. +- Go to a server on discord and attempt to mention yourself, but put a backslash at the start like shown below +- So the message `\@fearnlj01#3535` will appears as `<@145521851676884992>` after you send the message (to make it slightly easier, add the backslash after you type the mention out) +- Copy the numbers from the message you sent (`145521851676884992`) and replace the `0` on the `OwnerIds` section with your user ID shown earlier. +- Save `credentials.json` (make sure you aren't saving it as `credentials.json.txt`) +- If done correctly, you are now the bot owner. You can add multiple owners by seperating each owner ID with a comma within the square brackets. ####Inviting your bot to your server - [Invite Guide][Invite Guide] @@ -58,15 +62,11 @@ ________________________________________________________________________________ - Your bot should now be online in the server we added her to. - Note: Your bot will be offline in case you close the `NadekoBot` command prompt window. -####Setting up OwnerIds -- In the server where your bot is, in a text channel, type `.uid` -- Your `User ID` should show, copy it. -- Close `NadekoBot` -- Replace the `0` on the `OwnerIds` section with your user ID shown earlier. -- Run `NadekoRun.bat` again. -- If done correctly, you are now the bot owner. -- You can add multiple owner IDs by seperating them with a comma within the square brackets. - +####Updating NadekoBot +- Make sure the bot is closed and is not running (Run `.die` in a connected server to ensure it's not running). +- Run `NadekoInstaller.bat` again and wait for it to finish. +- Run `NadekoRun.bat`. +- You've updated, easy as that! ________________________________________________________________________________ #### Setting Up NadekoBot For Music From 5918105de2e74b274932ae5a20f9fc8a31ca13e5 Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sat, 22 Oct 2016 09:23:42 +0100 Subject: [PATCH 3/6] Not Updating CommandStrings.resx fuck you vim, forcing a new line at the end of file the one time I actually try to fix a conflict making my PR potentially look messy *grumble* From e48faf8e0422784844a96227f6a309d7c10047ff Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sat, 22 Oct 2016 09:26:37 +0100 Subject: [PATCH 4/6] Why would you do this to me vim Why would you insert a newline at the end of the file :eyes: From 9eded736f82b968ecb9be1ca8970e7e0ecfffe5b Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sat, 22 Oct 2016 09:27:55 +0100 Subject: [PATCH 5/6] I swear I've commited this three times already It would've been quicker to just end it all at this rate From db6367da63d713ce5da68c4f76388416fc98f92b Mon Sep 17 00:00:00 2001 From: Jordan Fearnley Date: Sat, 22 Oct 2016 09:32:18 +0100 Subject: [PATCH 6/6] Small detail added --- docs/guides/OSX Guide.md | 2 +- docs/guides/Windows Guide.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/OSX Guide.md b/docs/guides/OSX Guide.md index a13f0b9f..a475592a 100644 --- a/docs/guides/OSX Guide.md +++ b/docs/guides/OSX Guide.md @@ -77,7 +77,7 @@ A dialog box will open asking if you want to install `xcode-select`. Select inst - Again, copy the same `Client ID` and replace the null part of the `BotId` line with it, and do **not** put quotation marks before and after the ID. - Go to a server on discord and attempt to mention yourself, but put a backslash at the start as shown below - So the message `\@fearnlj01#3535` will appears as `<@145521851676884992>` after you send the message (to make it slightly easier, add the backslash after you type the mention out) -- Copy the numbers from the message you sent (`145521851676884992`) and replace the `0` on the `OwnerIds` section with your user ID shown earlier. +- The message will appear as a mention if done correctly, copy the numbers from the message you sent (`145521851676884992`) and replace the `0` on the `OwnerIds` section with your user ID shown earlier. - Save `credentials.json` (make sure you aren't saving it as `credentials.json.txt`) - If done correctly, you are now the bot owner. You can add multiple owners by seperating each owner ID with a comma within the square brackets. diff --git a/docs/guides/Windows Guide.md b/docs/guides/Windows Guide.md index 6bfdb01f..38ec73ce 100644 --- a/docs/guides/Windows Guide.md +++ b/docs/guides/Windows Guide.md @@ -44,7 +44,7 @@ ________________________________________________________________________________ - Again, copy the same `Client ID` and replace the `null` part of the `BotId` line with it. - Go to a server on discord and attempt to mention yourself, but put a backslash at the start like shown below - So the message `\@fearnlj01#3535` will appears as `<@145521851676884992>` after you send the message (to make it slightly easier, add the backslash after you type the mention out) -- Copy the numbers from the message you sent (`145521851676884992`) and replace the `0` on the `OwnerIds` section with your user ID shown earlier. +- The message will appear as a mention if done correctly, copy the numbers from the message you sent (`145521851676884992`) and replace the `0` on the `OwnerIds` section with your user ID shown earlier. - Save `credentials.json` (make sure you aren't saving it as `credentials.json.txt`) - If done correctly, you are now the bot owner. You can add multiple owners by seperating each owner ID with a comma within the square brackets.