Merge remote-tracking branch 'refs/remotes/Kwoth/1.0' into 1.0-fearnlj01
This commit is contained in:
commit
0f3f5a73a9
@ -97,12 +97,30 @@ sudo apt-get update && sudo apt-get install ffmpeg -y`
|
|||||||
####Getting NadekoBot
|
####Getting NadekoBot
|
||||||
|
|
||||||
**10)**
|
**10)**
|
||||||
`cd ~ && git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git`
|
|
||||||
|
- `cd ~`
|
||||||
|
- `curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh`
|
||||||
|
*Skip steps 10.5-11.5 and continue to run the bot, if you see errors while running, do the steps (10.5-11.5) below:*
|
||||||
|
|
||||||
|
**10.5)**
|
||||||
|
|
||||||
|
- `cd ~ && git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git`
|
||||||
|
|
||||||
####Building NadekoBot
|
####Building NadekoBot
|
||||||
|
|
||||||
**11)**
|
**11)**
|
||||||
`cd ~/NadekoBot/ && dotnet restore && cd ~/NadekoBot/src/NadekoBot/ && dotnet build --configuration Release`
|
|
||||||
|
- `cd ~/NadekoBot/ && dotnet restore && cd ~/NadekoBot/src/NadekoBot/ && dotnet build --configuration Release`
|
||||||
|
*if you see error, try:*
|
||||||
|
|
||||||
|
**11.5)**
|
||||||
|
|
||||||
|
- `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`
|
||||||
|
|
||||||
####Setting up NadekoBot
|
####Setting up NadekoBot
|
||||||
|
|
||||||
@ -130,14 +148,14 @@ sudo apt-get update && sudo apt-get install ffmpeg -y`
|
|||||||
Go back to **PuTTY**, `(hope its still running xD)`
|
Go back to **PuTTY**, `(hope its still running xD)`
|
||||||
|
|
||||||
**12)**
|
**12)**
|
||||||
Type/ Copy and hit **Enter**.
|
|
||||||
|
|
||||||
`tmux new -s nadeko`
|
`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.
|
**^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.
|
||||||
|
|
||||||
**13)**
|
**13)**
|
||||||
`dotnet run --configuration Release`
|
|
||||||
|
- `cd NadekoBot/src/NadekoBot/`
|
||||||
|
- `dotnet run --configuration Release`
|
||||||
|
|
||||||
**CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING**
|
**CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING**
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
####Installing Homebrew
|
####Installing Homebrew
|
||||||
|
|
||||||
`/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
```/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.
|
||||||
|
|
||||||
@ -26,14 +26,16 @@ brew install tmux
|
|||||||
```
|
```
|
||||||
|
|
||||||
####Installing .NET Core SDK
|
####Installing .NET Core SDK
|
||||||
|
|
||||||
- `ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/`
|
- `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/`
|
- `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)
|
- Download the .NET Core SDK, found [here.](https://go.microsoft.com/fwlink/?LinkID=827526)
|
||||||
- Open the `.pkg` file you downloaded and install it.
|
- Open the `.pkg` file you downloaded and install it.
|
||||||
|
- `ln -s /usr/local/share/dotnet/dotnet /usr/local/bin`
|
||||||
|
|
||||||
####Check your `FFMPEG`
|
####Check your `FFMPEG`
|
||||||
|
|
||||||
**In case your `FFMPEG` wasnt installed properly**
|
**In case your `FFMPEG` wasnt installed properly (Optional)**
|
||||||
|
|
||||||
- `brew options ffmpeg`
|
- `brew options ffmpeg`
|
||||||
- `brew install ffmpeg --with-x --with-y --with-z` etc.
|
- `brew install ffmpeg --with-x --with-y --with-z` etc.
|
||||||
@ -43,6 +45,7 @@ brew install tmux
|
|||||||
- Then try `brew install ffmpeg` again.
|
- Then try `brew install ffmpeg` again.
|
||||||
|
|
||||||
####Installing xcode-select
|
####Installing xcode-select
|
||||||
|
|
||||||
Xcode command line tools. You will do this in Terminal.app by running the following command line:
|
Xcode command line tools. You will do this in Terminal.app by running the following command line:
|
||||||
|
|
||||||
`xcode-select --install`
|
`xcode-select --install`
|
||||||
@ -50,11 +53,23 @@ Xcode command line tools. You will do this in Terminal.app by running the follow
|
|||||||
A dialog box will open asking if you want to install `xcode-select`. Select install and finish the installation.
|
A dialog box will open asking if you want to install `xcode-select`. Select install and finish the installation.
|
||||||
|
|
||||||
####Downloading and building Nadeko
|
####Downloading and building Nadeko
|
||||||
|
|
||||||
|
**METHOD I**
|
||||||
|
|
||||||
|
- `cd ~`
|
||||||
|
- `curl -L https://github.com/Kwoth/NadekoBot-BashScript/raw/master/nadeko_installer.sh | sh`
|
||||||
|
|
||||||
|
*If you fail to run the bot with* `METHOD I` *try:*
|
||||||
|
|
||||||
|
**METHOD II**
|
||||||
|
|
||||||
- `cd ~`
|
- `cd ~`
|
||||||
- `git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git`
|
- `git clone -b 1.0 --recursive https://github.com/Kwoth/NadekoBot.git`
|
||||||
- `cd ~/NadekoBot/`
|
- `cd ~/NadekoBot/discord.net`
|
||||||
|
- `dotnet restore -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json`
|
||||||
- `dotnet restore`
|
- `dotnet restore`
|
||||||
- `cd ~/NadekoBot/src/NadekoBot/`
|
- `cd ~/NadekoBot/src/NadekoBot/`
|
||||||
|
- `dotnet restore`
|
||||||
- `dotnet build --configuration Release`
|
- `dotnet build --configuration Release`
|
||||||
|
|
||||||
####Creating DiscordBot application
|
####Creating DiscordBot application
|
||||||
@ -67,7 +82,7 @@ A dialog box will open asking if you want to install `xcode-select`. Select inst
|
|||||||
- Keep this window open for now.
|
- Keep this window open for now.
|
||||||
|
|
||||||
####Setting up Credentials.json file
|
####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.
|
- 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.)
|
- 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`.
|
- If you mess up the setup of `credentials.json`, rename `credentials_example.json` to `credentials.json`.
|
||||||
- Open the file with your Text editor.
|
- Open the file with your Text editor.
|
||||||
@ -83,27 +98,31 @@ A dialog box will open asking if you want to install `xcode-select`. Select inst
|
|||||||
|
|
||||||
####Running NadekoBot
|
####Running NadekoBot
|
||||||
|
|
||||||
|
- Using tmux
|
||||||
|
|
||||||
`tmux new -s nadeko`
|
`tmux new -s nadeko`
|
||||||
|
|
||||||
^this will create a new session named “nadeko”
|
^this will create a new session named “nadeko”
|
||||||
`(you can replace “nadeko” with anything you prefer and remember its your session name)`.
|
`(you can replace “nadeko” with anything you prefer and remember its your session name)`.
|
||||||
|
|
||||||
or if you want to use Screen, run:
|
- Using Screen
|
||||||
|
|
||||||
|
If you want to use Screen, run:
|
||||||
|
|
||||||
`screen -S nadeko`
|
`screen -S nadeko`
|
||||||
|
|
||||||
^this will create a new screen named “nadeko”
|
^this will create a new screen named “nadeko”
|
||||||
`(you can replace “nadeko” with anything you prefer and remember its your screen name)`.
|
`(you can replace “nadeko” with anything you prefer and remember its your screen name)`.
|
||||||
|
|
||||||
`cd ~/NadekoBot/src/NadekoBot/`
|
|
||||||
|
|
||||||
- Start Nadeko using dotnet:
|
- Start Nadeko using dotnet:
|
||||||
|
|
||||||
|
`cd ~/NadekoBot/src/NadekoBot/`
|
||||||
|
|
||||||
`dotnet run --configuration Release`
|
`dotnet run --configuration Release`
|
||||||
|
|
||||||
CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING
|
CHECK THE BOT IN DISCORD, IF EVERYTHING IS WORKING
|
||||||
|
|
||||||
Now time to move bot to background and to do that, press CTRL+B+D (this will ditach the nadeko session using TMUX)
|
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)*
|
*If you used Screen press CTRL+A+D (this will detach the nadeko screen)*
|
||||||
|
|
||||||
@ -112,7 +131,7 @@ Now time to move bot to background and to do that, press CTRL+B+D (this will dit
|
|||||||
- Copy your `Client ID` from your [Discord bot applications page.][DiscordApp]
|
- Copy your `Client ID` from your [Discord bot applications page.][DiscordApp]
|
||||||
- Replace the `12345678` in this link `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with your `Client ID`.
|
- Replace the `12345678` in this link `https://discordapp.com/oauth2/authorize?client_id=12345678&scope=bot&permissions=66186303` with your `Client ID`.
|
||||||
- Your edited link should look like this: `https://discordapp.com/oauth2/authorize?client_id=**YOUR_CLENT_ID**&scope=bot&permissions=66186303`.
|
- 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`.
|
- Go to newly created link and pick the server, and click `Authorize`.
|
||||||
- Bot should be added to your server.
|
- Bot should be added to your server.
|
||||||
|
|
||||||
####Setting NadekoBot Music
|
####Setting NadekoBot Music
|
||||||
|
@ -407,6 +407,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[RequirePermission(GuildPermission.ManageRoles)]
|
||||||
[Priority(1)]
|
[Priority(1)]
|
||||||
public async Task SetMuteRole(IUserMessage imsg, [Remainder] string name)
|
public async Task SetMuteRole(IUserMessage imsg, [Remainder] string name)
|
||||||
{
|
{
|
||||||
@ -427,6 +428,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[RequirePermission(GuildPermission.ManageRoles)]
|
||||||
[Priority(0)]
|
[Priority(0)]
|
||||||
public Task SetMuteRole(IUserMessage imsg, [Remainder] IRole role)
|
public Task SetMuteRole(IUserMessage imsg, [Remainder] IRole role)
|
||||||
=> SetMuteRole(imsg, role.Name);
|
=> SetMuteRole(imsg, role.Name);
|
||||||
@ -856,7 +858,7 @@ namespace NadekoBot.Modules.Administration
|
|||||||
}
|
}
|
||||||
var title = $"Chatlog-{channel.Guild.Name}/#{channel.Name}-{DateTime.Now}.txt";
|
var title = $"Chatlog-{channel.Guild.Name}/#{channel.Name}-{DateTime.Now}.txt";
|
||||||
await (umsg.Author as IGuildUser).SendFileAsync(
|
await (umsg.Author as IGuildUser).SendFileAsync(
|
||||||
await JsonConvert.SerializeObject(new { Messages = msgs.Select(s => $"【{s.Timestamp:HH:mm:ss}】" + s.ToString()) }, Formatting.Indented).ToStream().ConfigureAwait(false),
|
await JsonConvert.SerializeObject(new { Messages = msgs.Select(s => $"【{s.Timestamp:HH:mm:ss}】{s.Author}:" + s.ToString()) }, Formatting.Indented).ToStream().ConfigureAwait(false),
|
||||||
title, title).ConfigureAwait(false);
|
title, title).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,12 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
if (guessStr != "H" && guessStr != "T" && guessStr != "HEADS" && guessStr != "TAILS")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (amount < 1)
|
if (amount < 3)
|
||||||
|
{
|
||||||
|
await channel.SendMessageAsync($"You can't bet less than 3{Gambling.CurrencySign}.")
|
||||||
|
.ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// todo update this
|
// todo update this
|
||||||
long userFlowers;
|
long userFlowers;
|
||||||
using (var uow = DbHandler.UnitOfWork())
|
using (var uow = DbHandler.UnitOfWork())
|
||||||
|
@ -102,24 +102,46 @@ namespace NadekoBot.Modules.Gambling
|
|||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public Task Award(IUserMessage umsg, long amount, [Remainder] IGuildUser usr) =>
|
[Priority(2)]
|
||||||
|
public Task Award(IUserMessage umsg, int amount, [Remainder] IGuildUser usr) =>
|
||||||
Award(umsg, amount, usr.Id);
|
Award(umsg, amount, usr.Id);
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
public async Task Award(IUserMessage umsg, long amount, [Remainder] ulong usrId)
|
[Priority(1)]
|
||||||
|
public async Task Award(IUserMessage umsg, int amount, ulong usrId)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
if (amount <= 0)
|
if (amount <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
await CurrencyHandler.AddCurrencyAsync(usrId, $"Awarded by bot owner. ({umsg.Author.Username}/{umsg.Author.Id})", (int)amount).ConfigureAwait(false);
|
await CurrencyHandler.AddCurrencyAsync(usrId, $"Awarded by bot owner. ({umsg.Author.Username}/{umsg.Author.Id})", amount).ConfigureAwait(false);
|
||||||
|
|
||||||
await channel.SendMessageAsync($"{umsg.Author.Mention} successfully awarded {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to <@{usrId}>!").ConfigureAwait(false);
|
await channel.SendMessageAsync($"{umsg.Author.Mention} successfully awarded {amount} {(amount == 1 ? Gambling.CurrencyName : Gambling.CurrencyPluralName)} to <@{usrId}>!").ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[OwnerOnly]
|
||||||
|
[Priority(0)]
|
||||||
|
public async Task Award(IUserMessage umsg, int amount, [Remainder] IRole role)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
var users = channel.Guild.GetUsers()
|
||||||
|
.Where(u => u.Roles.Contains(role))
|
||||||
|
.ToList();
|
||||||
|
await Task.WhenAll(users.Select(u => CurrencyHandler.AddCurrencyAsync(u.Id,
|
||||||
|
$"Awarded by bot owner to **{role.Name}** role. ({umsg.Author.Username}/{umsg.Author.Id})",
|
||||||
|
amount)))
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
await channel.SendMessageAsync($"Awarded `{amount}` {Gambling.CurrencyPluralName} to `{users.Count}` users from `{role.Name}` role.")
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
[OwnerOnly]
|
[OwnerOnly]
|
||||||
|
@ -63,7 +63,7 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
oldQuestions.Add(CurrentQuestion); //add it to exclusion list so it doesn't show up again
|
oldQuestions.Add(CurrentQuestion); //add it to exclusion list so it doesn't show up again
|
||||||
//sendquestion
|
//sendquestion
|
||||||
try { await channel.SendMessageAsync($":question: **{CurrentQuestion.Question}**").ConfigureAwait(false); }
|
try { await channel.SendMessageAsync($":question: **{CurrentQuestion.Question}**").ConfigureAwait(false); }
|
||||||
catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.Forbidden)
|
catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound || ex.StatusCode == System.Net.HttpStatusCode.Forbidden)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,12 @@ namespace NadekoBot.Modules.Games.Trivia
|
|||||||
//hint
|
//hint
|
||||||
await Task.Delay(HintTimeoutMiliseconds, token).ConfigureAwait(false);
|
await Task.Delay(HintTimeoutMiliseconds, token).ConfigureAwait(false);
|
||||||
if (ShowHints)
|
if (ShowHints)
|
||||||
try { await channel.SendMessageAsync($":exclamation:**Hint:** {CurrentQuestion.GetHint()}").ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
|
try { await channel.SendMessageAsync($":exclamation:**Hint:** {CurrentQuestion.GetHint()}").ConfigureAwait(false); }
|
||||||
|
catch (HttpException ex) when (ex.StatusCode == System.Net.HttpStatusCode.NotFound || ex.StatusCode == System.Net.HttpStatusCode.Forbidden)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (Exception ex) { _log.Warn(ex); }
|
||||||
|
|
||||||
//timeout
|
//timeout
|
||||||
await Task.Delay(QuestionDurationMiliseconds - HintTimeoutMiliseconds, token).ConfigureAwait(false);
|
await Task.Delay(QuestionDurationMiliseconds - HintTimeoutMiliseconds, token).ConfigureAwait(false);
|
||||||
|
@ -94,8 +94,8 @@ namespace NadekoBot.Modules.Searches
|
|||||||
{ "bn", "bn"},
|
{ "bn", "bn"},
|
||||||
{ "bg", "bg"},
|
{ "bg", "bg"},
|
||||||
{ "ca", "ca"},
|
{ "ca", "ca"},
|
||||||
{ "zh-TW", "zh-TW"},
|
{ "zh-tw", "zh-TW"},
|
||||||
{ "zh-CN", "zh-CN"},
|
{ "zh-cn", "zh-CN"},
|
||||||
{ "hr", "hr"},
|
{ "hr", "hr"},
|
||||||
{ "cs", "cs"},
|
{ "cs", "cs"},
|
||||||
{ "da", "da"},
|
{ "da", "da"},
|
||||||
|
99
src/NadekoBot/Modules/Searches/Commands/PlaceCommands.cs
Normal file
99
src/NadekoBot/Modules/Searches/Commands/PlaceCommands.cs
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
using Discord;
|
||||||
|
using Discord.Commands;
|
||||||
|
using NadekoBot.Attributes;
|
||||||
|
using NadekoBot.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace NadekoBot.Modules.Searches
|
||||||
|
{
|
||||||
|
public partial class Searches
|
||||||
|
{
|
||||||
|
[Group]
|
||||||
|
public class PlaceCommands
|
||||||
|
{
|
||||||
|
string typesStr { get; } = "";
|
||||||
|
public PlaceCommands()
|
||||||
|
{
|
||||||
|
typesStr = $"`List of \"{NadekoBot.ModulePrefixes[typeof(Searches).Name]}place\" tags:`\n" + String.Join(", ", Enum.GetNames(typeof(PlaceType)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum PlaceType
|
||||||
|
{
|
||||||
|
Cage, //http://www.placecage.com
|
||||||
|
Steven, //http://www.stevensegallery.com
|
||||||
|
Beard, //http://placebeard.it
|
||||||
|
Fill, //http://www.fillmurray.com
|
||||||
|
Bear, //https://www.placebear.com
|
||||||
|
Kitten, //http://placekitten.com
|
||||||
|
Bacon, //http://baconmockup.com
|
||||||
|
Xoart, //http://xoart.link
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
public async Task Placelist(IUserMessage imsg)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)imsg.Channel;
|
||||||
|
|
||||||
|
await channel.SendMessageAsync(typesStr)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
public async Task Place(IUserMessage imsg, PlaceType placeType, uint width = 0, uint height = 0)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)imsg.Channel;
|
||||||
|
|
||||||
|
string url = "";
|
||||||
|
switch (placeType)
|
||||||
|
{
|
||||||
|
case PlaceType.Cage:
|
||||||
|
url = "http://www.placecage.com";
|
||||||
|
break;
|
||||||
|
case PlaceType.Steven:
|
||||||
|
url = "http://www.stevensegallery.com";
|
||||||
|
break;
|
||||||
|
case PlaceType.Beard:
|
||||||
|
url = "http://placebeard.it";
|
||||||
|
break;
|
||||||
|
case PlaceType.Fill:
|
||||||
|
url = "http://www.fillmurray.com";
|
||||||
|
break;
|
||||||
|
case PlaceType.Bear:
|
||||||
|
url = "https://www.placebear.com";
|
||||||
|
break;
|
||||||
|
case PlaceType.Kitten:
|
||||||
|
url = "http://placekitten.com";
|
||||||
|
break;
|
||||||
|
case PlaceType.Bacon:
|
||||||
|
url = "http://baconmockup.com";
|
||||||
|
break;
|
||||||
|
case PlaceType.Xoart:
|
||||||
|
url = "http://xoart.link";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
var rng = new NadekoRandom();
|
||||||
|
if (width <= 0 || width > 1000)
|
||||||
|
width = (uint)rng.Next(250, 850);
|
||||||
|
|
||||||
|
if (height <= 0 || height > 1000)
|
||||||
|
height = (uint)rng.Next(250, 850);
|
||||||
|
|
||||||
|
url += $"/{width}/{height}";
|
||||||
|
|
||||||
|
//using (var http = new HttpClient())
|
||||||
|
//{
|
||||||
|
// var res = await http.GetStreamAsync(url).ConfigureAwait(false);
|
||||||
|
// await channel.SendFileAsync()
|
||||||
|
//}
|
||||||
|
await channel.SendMessageAsync(url).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ using NadekoBot.Attributes;
|
|||||||
using NadekoBot.Extensions;
|
using NadekoBot.Extensions;
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -12,6 +13,23 @@ namespace NadekoBot.Modules.Utility
|
|||||||
{
|
{
|
||||||
partial class Utility : DiscordModule
|
partial class Utility : DiscordModule
|
||||||
{
|
{
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
public async Task TogetherTube(IUserMessage imsg)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)imsg.Channel;
|
||||||
|
|
||||||
|
Uri target;
|
||||||
|
using (var http = new HttpClient())
|
||||||
|
{
|
||||||
|
var res = await http.GetAsync("https://togethertube.com/room/create").ConfigureAwait(false);
|
||||||
|
target = res.RequestMessage.RequestUri;
|
||||||
|
}
|
||||||
|
|
||||||
|
await channel.SendMessageAsync($"{imsg.Author.Mention}, `Here is the link:` {target}")
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task ServerInfo(IUserMessage msg, string guild = null)
|
public async Task ServerInfo(IUserMessage msg, string guild = null)
|
||||||
|
@ -93,28 +93,36 @@ namespace NadekoBot.Modules.Utility
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum MeOrHere
|
||||||
|
{
|
||||||
|
Me,Here
|
||||||
|
}
|
||||||
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Remind(IUserMessage umsg, string meorchannel, string timeStr, [Remainder] string message)
|
[Priority(1)]
|
||||||
|
public async Task Remind(IUserMessage umsg, MeOrHere meorhere, string timeStr, [Remainder] string message)
|
||||||
{
|
{
|
||||||
var channel = (ITextChannel)umsg.Channel;
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
var meorchStr = meorchannel.ToUpperInvariant();
|
IMessageChannel target;
|
||||||
IMessageChannel ch;
|
if (meorhere == MeOrHere.Me)
|
||||||
bool isPrivate = false;
|
|
||||||
if (meorchStr == "ME")
|
|
||||||
{
|
{
|
||||||
isPrivate = true;
|
target = await ((IGuildUser)umsg.Author).CreateDMChannelAsync().ConfigureAwait(false);
|
||||||
ch = await ((IGuildUser)umsg.Author).CreateDMChannelAsync().ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
else if (meorchStr == "HERE")
|
|
||||||
{
|
|
||||||
ch = channel;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ch = channel.Guild.GetTextChannels().FirstOrDefault(c => c.Name.ToUpperInvariant() == meorchStr || c.Id.ToString() == meorchStr);
|
target = channel;
|
||||||
}
|
}
|
||||||
|
await Remind(umsg, target, timeStr, message).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
|
[RequireContext(ContextType.Guild)]
|
||||||
|
[Priority(0)]
|
||||||
|
public async Task Remind(IUserMessage umsg, IMessageChannel ch, string timeStr, [Remainder] string message)
|
||||||
|
{
|
||||||
|
var channel = (ITextChannel)umsg.Channel;
|
||||||
|
|
||||||
if (ch == null)
|
if (ch == null)
|
||||||
{
|
{
|
||||||
@ -168,7 +176,7 @@ namespace NadekoBot.Modules.Utility
|
|||||||
var rem = new Reminder
|
var rem = new Reminder
|
||||||
{
|
{
|
||||||
ChannelId = ch.Id,
|
ChannelId = ch.Id,
|
||||||
IsPrivate = isPrivate,
|
IsPrivate = ch is IDMChannel,
|
||||||
When = time,
|
When = time,
|
||||||
Message = message,
|
Message = message,
|
||||||
UserId = umsg.Author.Id,
|
UserId = umsg.Author.Id,
|
||||||
|
@ -43,7 +43,7 @@ namespace NadekoBot
|
|||||||
SetupLogger();
|
SetupLogger();
|
||||||
_log = LogManager.GetCurrentClassLogger();
|
_log = LogManager.GetCurrentClassLogger();
|
||||||
|
|
||||||
_log.Info("Starting NadekoBot v" + typeof(NadekoBot).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion);
|
_log.Info("Starting NadekoBot v" + StatsService.BotVersion);
|
||||||
|
|
||||||
|
|
||||||
Credentials = new BotCredentials();
|
Credentials = new BotCredentials();
|
||||||
|
@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
|
|||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("")]
|
||||||
[assembly: AssemblyProduct("NadekoBot")]
|
[assembly: AssemblyProduct("NadekoBot")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyInformationalVersion("1.0-alpha")]
|
[assembly: AssemblyInformationalVersion("1.0")]
|
||||||
|
|
||||||
// Setting ComVisible to false makes the types in this assembly not visible
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
// to COM components. If you need to access a type in this assembly from
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
85
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
85
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -555,7 +555,7 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Awards someone a certain amount of currency. .
|
/// Looks up a localized string similar to Awards someone a certain amount of currency. You can also specify a role name to award currency to all users in a role..
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string award_desc {
|
public static string award_desc {
|
||||||
get {
|
get {
|
||||||
@ -564,7 +564,7 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to `{0}award 100 @person`.
|
/// Looks up a localized string similar to `{0}award 100 @person` or `{0}award 5 Role Of Gamblers`.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string award_usage {
|
public static string award_usage {
|
||||||
get {
|
get {
|
||||||
@ -4244,6 +4244,60 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to place.
|
||||||
|
/// </summary>
|
||||||
|
public static string place_cmd {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("place_cmd", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Shows a placeholder image of a given tag. Use `{0}placelist` to see all available tags. You can specify the width and height of the image as the last two optional arguments..
|
||||||
|
/// </summary>
|
||||||
|
public static string place_desc {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("place_desc", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to `{0}place Cage` or `{0}place steven 500 400`.
|
||||||
|
/// </summary>
|
||||||
|
public static string place_usage {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("place_usage", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to placelist.
|
||||||
|
/// </summary>
|
||||||
|
public static string placelist_cmd {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("placelist_cmd", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Shows the list of available tags for the `{0}place` command..
|
||||||
|
/// </summary>
|
||||||
|
public static string placelist_desc {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("placelist_desc", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to `{0}placelist`.
|
||||||
|
/// </summary>
|
||||||
|
public static string placelist_usage {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("placelist_usage", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to plant.
|
/// Looks up a localized string similar to plant.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -6350,6 +6404,33 @@ namespace NadekoBot.Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to togethertube totube.
|
||||||
|
/// </summary>
|
||||||
|
public static string togethertube_cmd {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("togethertube_cmd", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Creates a new room on <https://togethertube.com> and shows the link in the chat..
|
||||||
|
/// </summary>
|
||||||
|
public static string togethertube_desc {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("togethertube_desc", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to `{0}totube`.
|
||||||
|
/// </summary>
|
||||||
|
public static string togethertube_usage {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("togethertube_usage", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to tq.
|
/// Looks up a localized string similar to tq.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1246,10 +1246,10 @@
|
|||||||
<value>award</value>
|
<value>award</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="award_desc" xml:space="preserve">
|
<data name="award_desc" xml:space="preserve">
|
||||||
<value>Awards someone a certain amount of currency. </value>
|
<value>Awards someone a certain amount of currency. You can also specify a role name to award currency to all users in a role.</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="award_usage" xml:space="preserve">
|
<data name="award_usage" xml:space="preserve">
|
||||||
<value>`{0}award 100 @person`</value>
|
<value>`{0}award 100 @person` or `{0}award 5 Role Of Gamblers`</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="take_cmd" xml:space="preserve">
|
<data name="take_cmd" xml:space="preserve">
|
||||||
<value>take</value>
|
<value>take</value>
|
||||||
@ -2511,4 +2511,31 @@
|
|||||||
<data name="xkcd_usage" xml:space="preserve">
|
<data name="xkcd_usage" xml:space="preserve">
|
||||||
<value>`{0}xkcd` or `{0}xkcd 1400` or `{0}xkcd latest`</value>
|
<value>`{0}xkcd` or `{0}xkcd 1400` or `{0}xkcd latest`</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="placelist_cmd" xml:space="preserve">
|
||||||
|
<value>placelist</value>
|
||||||
|
</data>
|
||||||
|
<data name="placelist_desc" xml:space="preserve">
|
||||||
|
<value>Shows the list of available tags for the `{0}place` command.</value>
|
||||||
|
</data>
|
||||||
|
<data name="placelist_usage" xml:space="preserve">
|
||||||
|
<value>`{0}placelist`</value>
|
||||||
|
</data>
|
||||||
|
<data name="place_cmd" xml:space="preserve">
|
||||||
|
<value>place</value>
|
||||||
|
</data>
|
||||||
|
<data name="place_desc" xml:space="preserve">
|
||||||
|
<value>Shows a placeholder image of a given tag. Use `{0}placelist` to see all available tags. You can specify the width and height of the image as the last two optional arguments.</value>
|
||||||
|
</data>
|
||||||
|
<data name="place_usage" xml:space="preserve">
|
||||||
|
<value>`{0}place Cage` or `{0}place steven 500 400`</value>
|
||||||
|
</data>
|
||||||
|
<data name="togethertube_cmd" xml:space="preserve">
|
||||||
|
<value>togethertube totube</value>
|
||||||
|
</data>
|
||||||
|
<data name="togethertube_desc" xml:space="preserve">
|
||||||
|
<value>Creates a new room on <https://togethertube.com> and shows the link in the chat.</value>
|
||||||
|
</data>
|
||||||
|
<data name="togethertube_usage" xml:space="preserve">
|
||||||
|
<value>`{0}totube`</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
@ -17,7 +17,7 @@ namespace NadekoBot.Services.Impl
|
|||||||
private DateTime started;
|
private DateTime started;
|
||||||
private int commandsRan = 0;
|
private int commandsRan = 0;
|
||||||
|
|
||||||
public string BotVersion => "1.0-beta1";
|
public const string BotVersion = "1.0-rc1";
|
||||||
|
|
||||||
public string Heap => Math.Round((double)GC.GetTotalMemory(false) / 1.MiB(), 2).ToString();
|
public string Heap => Math.Round((double)GC.GetTotalMemory(false) / 1.MiB(), 2).ToString();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user