Merge remote-tracking branch 'upstream/1.0' into 1.0
This commit is contained in:
commit
fe346648f7
@ -4,11 +4,11 @@
|
|||||||
If you want Nadeko to play music for you 24/7 without having to hosting it on your PC and want to keep it cheap, reliable and convenient as possible, you can try Nadeko on Linux Digital Ocean Droplet using the link [DigitalOcean](http://m.do.co/c/46b4d3d44795/) (and using this link will be supporting Nadeko and will give you **$10 credit**)
|
If you want Nadeko to play music for you 24/7 without having to hosting it on your PC and want to keep it cheap, reliable and convenient as possible, you can try Nadeko on Linux Digital Ocean Droplet using the link [DigitalOcean](http://m.do.co/c/46b4d3d44795/) (and using this link will be supporting Nadeko and will give you **$10 credit**)
|
||||||
|
|
||||||
####Setting up NadekoBot
|
####Setting up NadekoBot
|
||||||
Assuming you have followed the link above to created an account in Digital Ocean and video to set up the bot until you get the `IP address and root password (in email)` to login, its time to begin.
|
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.
|
||||||
|
|
||||||
#### Prerequisites
|
#### Prerequisites
|
||||||
- Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
|
- Download [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html)
|
||||||
- Download [CyberDuck](https://cyberduck.io)
|
- Download [CyberDuck](https://cyberduck.io) or [WinSCP](https://winscp.net/eng/download.php)
|
||||||
|
|
||||||
#### Follow these steps
|
#### Follow these steps
|
||||||
|
|
||||||
@ -17,86 +17,90 @@ If you entered your Droplets IP address correctly, it should show **login as:**
|
|||||||
- Now for **login as:**, type `root` and hit enter.
|
- Now for **login as:**, type `root` and hit enter.
|
||||||
- It should then, ask for password, type the `root password` you have received in your **email address registered with Digital Ocean**, then hit Enter.
|
- It should then, ask for password, type the `root password` you have received in your **email address registered with Digital Ocean**, then hit Enter.
|
||||||
|
|
||||||
*(as you are running it for the first time, it will most likely to ask you to change your root password, for that, type the "password you received through email", hit Enter, enter a "new password", hit Enter and confirm that "new password" again.*
|
*as you are running it for the first time, it will most likely to ask you to change your root password, for that, type the "password you received through email", hit Enter, enter a "new password", hit Enter and confirm that "new password" again.*
|
||||||
**SAVE that new password somewhere safe, not just in your mind**. After you've done that, you are ready to write commands.
|
**SAVE that new password somewhere safe, not just in your mind**. After you've done that, you are ready to write commands.
|
||||||
|
|
||||||
**Copy the messages as normal, and just paste** by using **mouse right-click** (it should paste automatically)
|
**NOTE:** Copy the commands, and just paste them using **mouse single right-click.**
|
||||||
|
|
||||||
|
####Installing Git
|
||||||
|
|
||||||
####Installing git and dotnet
|
|
||||||
**1)**
|
|
||||||
`sudo apt-get install git -y`
|
`sudo apt-get install git -y`
|
||||||
|
|
||||||
Note if the command is not being initiated, hit **Enter**
|
**NOTE:** If the command is not being initiated, hit **Enter**
|
||||||
|
|
||||||
|
####Installing .NET Core SDK
|
||||||
|
|
||||||
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!
|
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
|
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 16/10/2016
|
||||||
|
|
||||||
**2)**
|
|
||||||
```
|
```
|
||||||
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 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-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-get update && sudo apt-get install dotnet-dev-1.0.0-preview2-003131 -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 <copied link>` (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
|
||||||
|
|
||||||
####Installing Opus Voice Codec and libsodium
|
####Installing Opus Voice Codec and libsodium
|
||||||
**3)**
|
|
||||||
`sudo apt-get install libopus0 opus-tools libopus-dev libsodium-dev -y`
|
`sudo apt-get install libopus0 opus-tools libopus-dev libsodium-dev -y`
|
||||||
|
|
||||||
####FFMPEG
|
####Installing FFMPEG
|
||||||
**4)**
|
|
||||||
`apt-get install ffmpeg -y`
|
`apt-get install ffmpeg -y`
|
||||||
|
|
||||||
NOTE: if its "not installing" then, follow the guide here: [FFMPEG Help Guide](http://www.faqforge.com/linux/how-to-install-ffmpeg-on-ubuntu-14-04/)
|
**NOTE:** If you are running **UBUNTU 14.04**, you must run these first:
|
||||||
|
|
||||||
**If you are running UBUNTU 14.04, you must run these first:**
|
|
||||||
```
|
```
|
||||||
sudo add-apt-repository ppa:mc3man/trusty-media
|
sudo add-apt-repository ppa:mc3man/trusty-media
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get dist-upgrade
|
sudo apt-get dist-upgrade
|
||||||
```
|
```
|
||||||
*Before executing* `sudo apt-get install ffmpeg`
|
|
||||||
|
|
||||||
**If you are running Debian 8 Jessie, please, follow these steps:**
|
**Before executing:** `sudo apt-get install ffmpeg`
|
||||||
|
|
||||||
`wget http://luxcaeli.de/installer.sh && sudo bash installer.sh` (Thanks to Eleria<3)
|
|
||||||
|
|
||||||
In case you are not able to install it with installer ^up there, follow these steps:
|
**NOTE:** If you are running **Debian 8 Jessie**, please, follow these steps:
|
||||||
|
|
||||||
|
`wget http://luxcaeli.de/installer.sh && sudo bash installer.sh` *Thanks to Eleria <3*
|
||||||
|
|
||||||
|
In case you are not able to install it with **installer**, follow these steps:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/debian-backports.list
|
echo "deb http://ftp.debian.org/debian jessie-backports main" | tee /etc/apt/sources.list.d/debian-backports.list
|
||||||
sudo apt-get update && sudo apt-get install ffmpeg -y`
|
sudo apt-get update && sudo apt-get install ffmpeg -y
|
||||||
```
|
```
|
||||||
|
|
||||||
####Installing TMUX
|
####Installing TMUX
|
||||||
**5)**
|
|
||||||
`sudo apt-get install tmux -y`
|
`sudo apt-get install tmux -y`
|
||||||
|
|
||||||
####Getting NadekoBot
|
####Getting NadekoBot
|
||||||
|
|
||||||
**6)**
|
`cd ~ && curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh`
|
||||||
```
|
|
||||||
cd ~
|
|
||||||
curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh
|
|
||||||
```
|
|
||||||
**If you do not get any errors using the above steps move to the next section, Setting up NadekoBot otherwise, if you get errors follow step 6.1**
|
|
||||||
|
|
||||||
**6.1)**
|
####Setting up and Inviting bot
|
||||||
```
|
|
||||||
cd ~ && git clone -b 1.0 --recursive --depth 1 https://github.com/Kwoth/NadekoBot.git
|
|
||||||
cd ~/NadekoBot/discord.net/src/Discord.Net && dotnet restore && cd ../Discord.Net.Commands && dotnet restore && cd ../../../src/NadekoBot/ && dotnet restore && dotnet build --configuration Release`
|
|
||||||
```
|
|
||||||
|
|
||||||
**If you still get some errors using the above steps, follow step 6.2**
|
- Read here how to [create a DiscordBot application](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#creating-discordbot-application)
|
||||||
**6.2)**
|
- [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).
|
||||||
cd ~/NadekoBot/discord.net && dotnet restore -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json && dotnet restore
|
- Replace the `12345678` in this link `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with your `Client ID`.
|
||||||
cd ~/NadekoBot/src/NadekoBot/ && dotnet restore && dotnet build --configuration Release
|
- 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 NadekoBot
|
####Setting up NadekoBot
|
||||||
|
|
||||||
@ -109,47 +113,34 @@ cd ~/NadekoBot/src/NadekoBot/ && dotnet restore && dotnet build --configuration
|
|||||||
- In **Password:** type `the new root password (you changed at the start)`
|
- In **Password:** type `the new root password (you changed at the start)`
|
||||||
- Click on **Connect**
|
- Click on **Connect**
|
||||||
- It should show you the NadekoBot folder which was created by git earlier
|
- 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.json` here
|
- Open that folder, then open the `src` folder, followed by another `NadekoBot` folder and you should see `credentials.json` there.
|
||||||
|
|
||||||
####Setting up credentials.json
|
####Setting up credentials.json
|
||||||
|
|
||||||
- Copy the `credentials.json` to desktop
|
- 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)
|
- 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. `(Using CyberDuck/WinSCP)`
|
||||||
- Paste/put it back in the folder once done. `(Yes, using CyberDuck)`
|
- 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` 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.
|
- If you have Nadeko 0.9x follow the [Upgrading Guide](http://nadekobot.readthedocs.io/en/1.0/guides/Upgrading%20Guide/)
|
||||||
|
|
||||||
####Inviting your bot to your server
|
####Setting up Music
|
||||||
- [Invite Guide](http://discord.kongslien.net/guide.html)
|
|
||||||
- Copy your `Client ID` from your [applications page](https://discordapp.com/developers/applications/me).
|
To set up Nadeko for music and Google API Keys, follow [Setting up NadekoBot for Music](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-nadekobot-for-music)
|
||||||
- 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`.
|
Once done, go back to **PuTTY**
|
||||||
- Go to the newly created link and pick the server we created, and click `Authorize`.
|
|
||||||
- The bot should have been added to your server.
|
|
||||||
|
|
||||||
####Running NadekoBot
|
####Running NadekoBot
|
||||||
|
|
||||||
Go back to **PuTTY**
|
- `tmux new -s nadeko`
|
||||||
|
|
||||||
**7)**
|
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.
|
||||||
`tmux new -s nadeko`
|
|
||||||
|
|
||||||
**^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.
|
|
||||||
|
|
||||||
**8)**
|
|
||||||
|
|
||||||
- `cd NadekoBot/src/NadekoBot/`
|
- `cd NadekoBot/src/NadekoBot/`
|
||||||
- `dotnet run --configuration Release`
|
- `dotnet run --configuration Release`
|
||||||
|
|
||||||
**CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING**
|
**Now check your Discord, the bot should be online**
|
||||||
|
|
||||||
####Setting up Nadeko Music
|
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.
|
||||||
|
|
||||||
For how to set up Nadeko for music and Google API Keys, follow [Setting up NadekoBot for Music](http://nadekobot.readthedocs.io/en/1.0/guides/Windows%20Guide/#setting-up-nadekobot-for-music)
|
|
||||||
|
|
||||||
Now time to **move 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.
|
|
||||||
|
|
||||||
**NOW YOU HAVE YOUR OWN NADEKO BOT** `Thanks to Kwoth <3`
|
|
||||||
|
|
||||||
####Some more Info (just in case)
|
####Some more Info (just in case)
|
||||||
|
|
||||||
@ -164,10 +155,21 @@ Open **PuTTY** and login as you have before, type `reboot` and hit Enter.
|
|||||||
|
|
||||||
- Make sure the bot is **not** running
|
- Make sure the bot is **not** running
|
||||||
- Connect to the terminal
|
- Connect to the terminal
|
||||||
- `cd ~\NadekoBot\`
|
- `cd ~ && curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh` (The same command used to install earlier)
|
||||||
- `git init && git pull`
|
- Run the bot again as normal.
|
||||||
- Run the bot again as normal, and you've updated!
|
|
||||||
|
|
||||||
HIT **CTRL+B+D** and close **PuTTY**
|
####Alternative way to Install
|
||||||
|
|
||||||
*IF YOU FACE ANY TROUBLE ANYWHERE IN THE GUIDE JUST FIND US IN [NADEKO'S DISCORD SERVER](https://discord.gg/0ehQwTK2RBjAxzEY)*
|
- If the [Nadeko installer](http://nadekobot.readthedocs.io/en/1.0/guides/Linux%20Guide/#getting-nadekobot) shows errors, try manually installing with the following steps:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ~ && git clone -b 1.0 --recursive --depth 1 https://github.com/Kwoth/NadekoBot.git
|
||||||
|
cd ~/NadekoBot/discord.net/src/Discord.Net && dotnet restore && cd ../Discord.Net.Commands && dotnet restore && cd ../../../src/NadekoBot/ && dotnet restore && dotnet build --configuration Release
|
||||||
|
```
|
||||||
|
|
||||||
|
- If you are still getting errors using the above steps:
|
||||||
|
|
||||||
|
```
|
||||||
|
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
|
||||||
|
```
|
||||||
|
@ -11,6 +11,7 @@ using System.Collections.Concurrent;
|
|||||||
using NadekoBot.Services.Database.Models;
|
using NadekoBot.Services.Database.Models;
|
||||||
using Discord;
|
using Discord;
|
||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace NadekoBot.Modules.CustomReactions
|
namespace NadekoBot.Modules.CustomReactions
|
||||||
{
|
{
|
||||||
@ -114,6 +115,7 @@ namespace NadekoBot.Modules.CustomReactions
|
|||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[Priority(0)]
|
||||||
public async Task ListCustReact(IUserMessage imsg, int page = 1)
|
public async Task ListCustReact(IUserMessage imsg, int page = 1)
|
||||||
{
|
{
|
||||||
var channel = imsg.Channel as ITextChannel;
|
var channel = imsg.Channel as ITextChannel;
|
||||||
@ -129,7 +131,72 @@ namespace NadekoBot.Modules.CustomReactions
|
|||||||
if (customReactions == null || !customReactions.Any())
|
if (customReactions == null || !customReactions.Any())
|
||||||
await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false);
|
await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false);
|
||||||
else
|
else
|
||||||
await imsg.Channel.SendMessageAsync($"`Page {page} of custom reactions:`\n" + string.Join("\n", customReactions.OrderBy(cr => cr.Trigger).Skip((page - 1) * 15).Take(15).Select(cr => $"`#{cr.Id}` `Trigger:` {cr.Trigger}")))
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum All
|
||||||
|
{
|
||||||
|
All
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[Priority(1)]
|
||||||
|
public async Task ListCustReact(IUserMessage imsg, All x)
|
||||||
|
{
|
||||||
|
var channel = imsg.Channel as ITextChannel;
|
||||||
|
|
||||||
|
ConcurrentHashSet<CustomReaction> customReactions;
|
||||||
|
if (channel == null)
|
||||||
|
customReactions = GlobalReactions;
|
||||||
|
else
|
||||||
|
customReactions = GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CustomReaction>());
|
||||||
|
|
||||||
|
if (customReactions == null || !customReactions.Any())
|
||||||
|
await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var txtStream = await customReactions.GroupBy(cr => cr.Trigger)
|
||||||
|
.OrderBy(cr => cr.Key)
|
||||||
|
.Select(cr => new { Trigger = cr.Key, Responses = cr.Count() })
|
||||||
|
.ToJson()
|
||||||
|
.ToStream()
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
if (channel == null) // its a private one, just send back
|
||||||
|
await imsg.Channel.SendFileAsync(txtStream, "customreactions.txt", "List of all custom reactions").ConfigureAwait(false);
|
||||||
|
else
|
||||||
|
await ((IGuildUser)imsg.Author).SendFileAsync(txtStream, "customreactions.txt", "List of all custom reactions").ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
public async Task ListCustReactG(IUserMessage imsg, int page = 1)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)imsg.Channel;
|
||||||
|
if (page < 1 || page > 10000)
|
||||||
|
return;
|
||||||
|
ConcurrentHashSet<CustomReaction> customReactions;
|
||||||
|
if (channel == null)
|
||||||
|
customReactions = GlobalReactions;
|
||||||
|
else
|
||||||
|
customReactions = GuildReactions.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CustomReaction>());
|
||||||
|
|
||||||
|
if (customReactions == null || !customReactions.Any())
|
||||||
|
await imsg.Channel.SendMessageAsync("`No custom reactions found`").ConfigureAwait(false);
|
||||||
|
else
|
||||||
|
await imsg.Channel.SendMessageAsync($"{imsg.Author.Mention}\n`Page {page} of custom reactions (grouped):`\n" +
|
||||||
|
string.Join("\r\n", customReactions
|
||||||
|
.GroupBy(cr=>cr.Trigger)
|
||||||
|
.OrderBy(cr => cr.Key)
|
||||||
|
.Skip((page - 1) * 20)
|
||||||
|
.Take(20)
|
||||||
|
.Select(cr => $"**{cr.Key.Trim().ToLowerInvariant()}** `x{cr.Count()}`")))
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
|
|
||||||
role = role ?? channel.Guild.EveryoneRole;
|
role = role ?? channel.Guild.EveryoneRole;
|
||||||
|
|
||||||
var members = role.Members().Where(u => u.Status == UserStatus.Online);
|
var members = role.Members().Where(u => u.Status != UserStatus.Offline && u.Status != UserStatus.Unknown);
|
||||||
var membersArray = members as IUser[] ?? members.ToArray();
|
var membersArray = members as IUser[] ?? members.ToArray();
|
||||||
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
|
var usr = membersArray[new NadekoRandom().Next(0, membersArray.Length)];
|
||||||
await channel.SendMessageAsync($"**Raffled user:** {usr.Username} (id: {usr.Id})").ConfigureAwait(false);
|
await channel.SendMessageAsync($"**Raffled user:** {usr.Username} (id: {usr.Id})").ConfigureAwait(false);
|
||||||
|
@ -337,7 +337,7 @@ namespace NadekoBot.Modules.Music.Classes
|
|||||||
var allVideos = await Task.Run(async () => { try { return await YouTube.Default.GetAllVideosAsync(link).ConfigureAwait(false); } catch { return Enumerable.Empty<YouTubeVideo>(); } }).ConfigureAwait(false);
|
var allVideos = await Task.Run(async () => { try { return await YouTube.Default.GetAllVideosAsync(link).ConfigureAwait(false); } catch { return Enumerable.Empty<YouTubeVideo>(); } }).ConfigureAwait(false);
|
||||||
var videos = allVideos.Where(v => v.AdaptiveKind == AdaptiveKind.Audio);
|
var videos = allVideos.Where(v => v.AdaptiveKind == AdaptiveKind.Audio);
|
||||||
var video = videos
|
var video = videos
|
||||||
.Where(v => v.AudioBitrate < 192)
|
.Where(v => v.AudioBitrate < 256)
|
||||||
.OrderByDescending(v => v.AudioBitrate)
|
.OrderByDescending(v => v.AudioBitrate)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
@ -436,10 +436,19 @@
|
|||||||
<value>listcustreact lcr</value>
|
<value>listcustreact lcr</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="listcustreact_desc" xml:space="preserve">
|
<data name="listcustreact_desc" xml:space="preserve">
|
||||||
<value>Lists global or server custom reactions (15 commands per page). Running the command in DM will list global custom reactions, while running it in server will list that server's custom reactions.</value>
|
<value>Lists global or server custom reactions (20 commands per page). Running the command in DM will list global custom reactions, while running it in server will list that server's custom reactions. Specifying `all` argument instead of the number will DM you a text file with a list of all custom reactions.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="listcustreact_usage" xml:space="preserve">
|
<data name="listcustreact_usage" xml:space="preserve">
|
||||||
<value>`{0}lcr 1`</value>
|
<value>`{0}lcr 1` or `{0}lcr all`</value>
|
||||||
|
</data>
|
||||||
|
<data name="listcustreactg_cmd" xml:space="preserve">
|
||||||
|
<value>listcustreactg lcrg</value>
|
||||||
|
</data>
|
||||||
|
<data name="listcustreactg_desc" xml:space="preserve">
|
||||||
|
<value>Lists global or server custom reactions (20 commands per page) grouped by trigger, and show a number of responses for each. Running the command in DM will list global custom reactions, while running it in server will list that server's custom reactions.</value>
|
||||||
|
</data>
|
||||||
|
<data name="listcustreactg_usage" xml:space="preserve">
|
||||||
|
<value>`{0}lcrg 1`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="showcustreact_cmd" xml:space="preserve">
|
<data name="showcustreact_cmd" xml:space="preserve">
|
||||||
<value>showcustreact scr</value>
|
<value>showcustreact scr</value>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
using ImageProcessorCore;
|
using ImageProcessorCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -287,6 +289,9 @@ namespace NadekoBot.Extensions
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToJson<T>(this T any, Formatting formatting = Formatting.Indented) =>
|
||||||
|
JsonConvert.SerializeObject(any, formatting);
|
||||||
|
|
||||||
public static int KiB(this int value) => value * 1024;
|
public static int KiB(this int value) => value * 1024;
|
||||||
public static int KB(this int value) => value * 1000;
|
public static int KB(this int value) => value * 1000;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user