Merge remote-tracking branch 'upstream/dev' into dev

This commit is contained in:
fkndean 2016-12-02 20:03:41 -05:00
commit 2c7820e9c3
9 changed files with 73 additions and 79 deletions

View File

@ -1,7 +1,7 @@
### How to contribute
1. Make Pull Requests to the **1.0 BRANCH**
2. Keep 1 Pull Request to a single feature
3. Explain what you did in the PR message
1. Make Pull Requests to the [**dev BRANCH**](https://github.com/Kwoth/NadekoBot/tree/dev).
2. Keep 1 Pull Request to a single feature.
3. Explain what you did in the PR message.
Thanks for all the help ^_^
Thanks for all your help ^_^

View File

@ -3,11 +3,11 @@
###Question 1: How do I get Nadeko to join my server?
----
**Answer:** Simply send Nadeko a Direct Message with -h and follow the link. **Only People with the Manage Server permission can add the bot to the server**
**Answer:** Simply send Nadeko a Direct Message with `-h` and follow the link. **Only People with the Manage Server permission can add the bot to the server**
###Question 2: I want to change permissions, but it isn't working!
----
**Answer:** You must have the ;permrole (by default this is the "Nadeko" role, for more details on permissions check [here](http://nadekobot.readthedocs.io/en/1.0/Permissions%20System/ "Permissions"). If you have a role called `Nadeko` but can't assign it, just create a new Role and assign that instead.)
**Answer:** You must have the `;permrole` (by default this is the `Nadeko` role, for more details on permissions check [here](http://nadekobot.readthedocs.io/en/latest/Permissions%20System/ "Permissions"). If you have a role called `Nadeko` but can't assign it it's probably the Bot Role so, just create a **New Role** called `Nadeko` and assign that to yourself instead.)
###Question 3: I want to disable NSFW on my server.
----
@ -27,51 +27,43 @@ If your problem or suggestion is not there, feel free to request/notify us about
--------
**Answer:** You can see the description and usage of certain commands by using `-h command` **i.e** `-h ;sm`.
The whole list of commands can be found [here](http://nadekobot.readthedocs.io/en/1.0/Commands%20List/ "Command List")
The whole list of commands can be found [here](http://nadekobot.readthedocs.io/en/latest/Commands%20List/ "Command List")
###Question 7: Music isn't working?
----
**Answer:** Music is disabled on public Nadeko due to large hosting costs, it will be re-enabled later in the future for donators.
**If you would like music in the meantime, you must host Nadeko yourself**. Be sure you have FFMPEG installed correctly, and have followed the [guide](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/) carefully.
**If you would like music in the meantime, you must host Nadeko yourself**. Be sure you have FFMPEG installed correctly, and have followed the [guide](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-nadekobot-for-music) carefully.
###Question 8: My music is still not working/very laggy?
----
**Answer:** Try changing your discord [location][1], if this doesn't work be sure you have enabled the correct permissions for Nadeko and rebooted since installing FFMPEG.
[1]: https://support.discordapp.com/hc/en-us/articles/216661717-How-do-I-change-my-Voice-Server-Region-
###Question 9: I want to change data in the database (like NadekoFlowers or the pokemontypes of users, but how?
###Question 9: I want to change data in the database like NadekoFlowers or something else but how?
----
**Answer:** Open `/data/NadekoBot.db` using sqlitebrowser (or some alternative), Browse Data, select relevant table, change data, Write changes
**Answer:** Follow the [DB Guide](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#db-files), Open `/data/NadekoBot.db` using **sqlitebrowser** (or some alternative), Browse Data, select relevant table, change data, Write changes and done.
###Question 10: The .greet and .bye commands doesn't work, but everything else is (From @Kong)
###Question 10: The .greet and .bye commands doesn't work, but everything else is!
-----
**Answer:** Set a greeting message by using `.greetmsg YourMessageHere` and a bye-message by using `.byemsg YourMessageHere`. Don't forget that `.greet` and `.bye` only apply to users joining a server, not coming online/offline.
###Question 11: How do I import certs on linux?
-------
**Answer:**
`certmgr -ssl https://discordapp.com`
`certmgr -ssl https://gateway.discord.gg`
###Question 12: I made an application, but I can't add that new bot to my server, how do I invite it to my server?
###Question 11: I made an application, but I can't add that new bot to my server, how do I invite it to my server?
----
**Answer:** You need to use oauth link to add it to you server, just copy your CLIENT ID (that's in the same Developer page where you brought your token) and replace `12345678` in the link below: https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303
**Answer:** You need to use oauth link to add it to you server, just copy your **CLIENT ID** (that's in the same [Developer page](https://discordapp.com/developers/applications/me) where you brought your token) and replace `12345678` in the link below: **https://discordapp.com/oauth2/authorize?client_id=`12345678`&scope=bot&permissions=66186303**
Follow this Detailed [Guide](http://discord.kongslien.net/guide.html) if you do not understand.
Follow this Detailed [Guide](http://discord.kongslien.net/guide.html).
###Question 13: I'm building NadekoBot from source, but I get hundreds of (namespace) errors without changing anything!?
###Question 12: I'm building NadekoBot from source, but I get hundreds of (namespace) errors without changing anything!?
-----
**Answer:** Using Visual Studio, you can solve these errors by going to `Tools` -> `NuGet Package Manager` -> `Manage NuGet Packages for Solution`. Go to the Installed tab, select the Packages that were missing (usually `Newtonsoft.json` and `RestSharp`) and install them for all projects
###Question 14: My bot has all permissions but it's still saying, "Failed to add roles. Bot has insufficient permissions.". How do I fix this?
###Question 13: My bot has all permissions but it's still saying, "Failed to add roles. Bot has insufficient permissions". How do I fix this?
----------
**Answer:** Discord has added a few new features and roles now follow hierarchy. This means you need to place your bot's role above every-other role your server has. [Here's](https://support.discordapp.com/hc/en-us/articles/214836687-Role-Management-101) a link to Discords role management 101.
###Question 15: I've broken permissions and am stuck, can I reset permissions?
----------
**Answer:** Yes, there is a way, in one easy command! Just run `.resetperms`
**Answer:** Discord has added few new features and the roles now follows the role hierarchy which means you need to place your bot's role above every-other role your server has to fix the role hierarchy issue. [Here's](https://support.discordapp.com/hc/en-us/articles/214836687-Role-Management-101) a link to Discords role management 101.
**Please Note:** *The bot can only set/add all roles below its own highest role. It can not assign it's "highest role" to anyone else.*
###Question 14: I've broken permissions and am stuck, can I reset permissions?
----------
**Answer:** Yes, there is a way, in one easy command! Just run `.resetperms` and all the permissions you've set through **Permissions Module** will reset.

View File

@ -59,9 +59,24 @@ Additional options
Config.json
===========
In the folder where `NadekoBot.exe` is located you should also see a `Data` folder. In this folder you will find `config.json` among other files.
`config.json` contains user specific commands, such as: if DM's sent to the bot are forwarded to you, Blacklisted Ids, Servers, and channels...etc.
`config.json` is now removed with the addition of `NadekoBot.db` so if you have Nadeko 0.9x follow the [upgrading guide](http://nadekobot.readthedocs.io/en/latest/guides/Upgrading%20Guide/) to upgrade your bot.
**If you do not see** `config.json` **you need to rename** `config_example.json` **to** `config.json`
DB files
========
Nadeko uses few db files in order to open these database files `NadekoBot\src\NadekoBot\bin\Release\netcoreapp1.0\data\NadekoBot.db` (1.0) or `data\NadekoBot.sqlite` (0.9x) you will need [DB Browser for SQLite](http://sqlitebrowser.org/).
To make changes
- go to **Browse Data** tab
- click on **Table** drop-down list
- choose the table you want to edit
- click on the cell you want to edit
- edit it on the right-hand side
- click on **Apply**
- click on **Write Changes**
and that will save all the changes.
![nadekodb](https://cdn.discordapp.com/attachments/251504306010849280/254067055240806400/nadekodb.gif)
[CleverBot APIs]: https://cleverbot.io/keys

View File

@ -69,30 +69,26 @@ Choose either `1` or `2` then press `enter` key.
Once Installation is completed you should see the options again.
Next, choose `5` to exit.
####Creating DiscordBot application
- Go to [the Discord developer application page.][DiscordApp]
- Log in with your Discord account.
- On the left side, press `New Application`.
- Fill out the `App Name` (your bot's name, in this case), put the image you want, and add an app description(optional).
- Create the application.
- Click on `Create a Bot User` and confirm it.
- Keep this window open for now.
####Creating and Inviting bot
- Read here how to [create a DiscordBot application](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#creating-discordbot-application)
- [Visual Invite Guide](http://discord.kongslien.net/guide.html) *NOTE: Client ID is your Bot ID*
- Copy your `Client ID` from your [applications page](https://discordapp.com/developers/applications/me).
- Replace the `12345678` in this link `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with your `Client ID`.
- The link should now look like this: `https://discordapp.com/oauth2/authorize?client_id=**YOUR_CLENT_ID_HERE**&scope=bot&permissions=66186303`.
- 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 Credentials.json file
- Open up the `NadekoBot` folder, which should be in your home directory, then `NadekoBot` folder then `src` folder and then the additonal `NadekoBot` folder.
- 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`, paste your bot token inbetween the quotation marks before and after the token, like so `"Example.Token"`
- Copy the `Client ID` on the page and replace the `123123123` 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.
- 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)
- 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.
- EDIT it as it is guided here: [Setting up credentials.json](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-credentialsjson-file)
- **If** you already have Nadeko 1.0 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`.
- **If** you have Nadeko 0.9x follow the [Upgrading Guide](http://nadekobot.readthedocs.io/en/latest/guides/Upgrading%20Guide/)
####Setting NadekoBot Music
For Music Setup and API keys check [Setting up NadekoBot for Music](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-nadekobot-for-music) and [JSON Explanations](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/).
####Running NadekoBot
- Using tmux
@ -125,19 +121,7 @@ Choose `4` To Run the bot with Auto Restart.
**Now check your Discord, the bot should be online**
Now time to move bot to background and to do that, press CTRL+B+D (this will detach the nadeko session using TMUX)
If you used Screen press CTRL+A+D (this will detach the nadeko screen)
####Inviting your bot to your server
- [Invite Guide](http://discord.kongslien.net/guide.html)
- Copy your `Client ID` from your [applications page](https://discordapp.com/developers/applications/me).
- Replace the `12345678` in this link `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with your `Client ID`.
- The link should now look like this: `https://discordapp.com/oauth2/authorize?client_id=**YOUR_CLENT_ID_HERE**&scope=bot&permissions=66186303`.
- 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 NadekoBot Music
For Music Setup and API keys check [Setting up NadekoBot for Music](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/#setting-up-nadekobot-for-music) and [JSON Explanations](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/).
If you used Screen press CTRL+A+D (this will detach the nadeko screen)
####Updating Nadeko

View File

@ -1,9 +1,11 @@
###Upgrading Nadeko from an older release
##Upgrading Nadeko from an older release
- Follow the Windows Guide/Linux Guide/OS X Guide linked on the left.
- Navigate to your old `Nadeko` folder and copy `credentials.json` and the `/data/` folder.
- Paste this into the new Nadeko's `/NadekoBot/src/NadekoBot/` folder.
**If you have NadekoBot 0.9x**
- Follow the [Windows Guide](http://nadekobot.readthedocs.io/en/latest/guides/Windows%20Guide/)/[Linux Guide](http://nadekobot.readthedocs.io/en/latest/guides/Linux%20Guide/)/[OS X Guide](http://nadekobot.readthedocs.io/en/latest/guides/OSX%20Guide/) and install **NadekoBot 1.0**.
- Navigate to your **old** `Nadeko` folder and copy `credentials.json` file and the `data` folder.
- Paste them into **NadekoBot 1.0** `/NadekoBot/src/NadekoBot/` folder.
- If it asks you to overwrite files, it is fine to do so.
- Now launch new Nadeko as the guide describes.
- In any channel, run the `.migratedata` command - nadeko will now migrate your old data.
- Restart nadeko and everything should work as expected!
- Next launch your **new** Nadeko as the guide describes, if it is not already running.
- In any channel, run the `.migratedata` [command](http://nadekobot.readthedocs.io/en/latest/Commands%20List/) and Nadeko will start migrating your old data.
- Once that is done **restart** Nadeko and everything should work as expected!

View File

@ -638,9 +638,9 @@ namespace NadekoBot.Modules.Administration
public async Task Prune(IUserMessage umsg)
{
var channel = (ITextChannel)umsg.Channel;
var user = channel.Guild.GetCurrentUser();
var enumerable = (await umsg.Channel.GetMessagesAsync()).AsEnumerable();
enumerable = enumerable.Where(x => x.Author.Id == user.Id);
await umsg.Channel.DeleteMessagesAsync(enumerable);

View File

@ -159,7 +159,7 @@ namespace NadekoBot.Modules.CustomReactions
{
var txtStream = await customReactions.GroupBy(cr => cr.Trigger)
.OrderBy(cr => cr.Key)
.Select(cr => new { Trigger = cr.Key, Responses = cr.Count() })
.Select(cr => new { Trigger = cr.Key, Responses = cr.Select(y => y.Response).ToList() })
.ToJson()
.ToStream()
.ConfigureAwait(false);
@ -173,7 +173,7 @@ namespace NadekoBot.Modules.CustomReactions
[NadekoCommand, Usage, Description, Aliases]
public async Task ListCustReactG(IUserMessage imsg, int page = 1)
{
var channel = (ITextChannel)imsg.Channel;
var channel = imsg.Channel as ITextChannel;
if (page < 1 || page > 10000)
return;
ConcurrentHashSet<CustomReaction> customReactions;

View File

@ -535,7 +535,7 @@ namespace NadekoBot.Modules.Searches
if (matches.Count == 0)
return null;
var match = matches[rng.Next(0, matches.Count)];
return matches[rng.Next(0, matches.Count)].Groups["url"].Value;
return "http:" + matches[rng.Next(0, matches.Count)].Groups["url"].Value;
}
}

View File

@ -97,7 +97,8 @@ __`Users:`__ **{(await ch.GetUsersAsync()).Count()}**";
🗓 __`Joined Discord:`__ **{user.CreatedAt.ToString("dd.MM.yyyy HH:mm")}**
__`Roles:`__ **({user.Roles.Count()}) - {string.Join(", ", user.Roles.Select(r => r.Name)).SanitizeMentions()}**";
if (!string.IsNullOrWhiteSpace(user.AvatarUrl))
toReturn += $@"📷 __`Avatar URL:`__ **{await NadekoBot.Google.ShortenUrl(user.AvatarUrl).ConfigureAwait(false)}**";
toReturn += $@"
📷 __`Avatar URL:`__ **{await NadekoBot.Google.ShortenUrl(user.AvatarUrl).ConfigureAwait(false)}**";
await msg.Reply(toReturn).ConfigureAwait(false);
}
}