Merge remote-tracking branch 'remotes/NadekoBot/1.9' into 1.9

This commit is contained in:
xsftk 2017-11-15 13:31:33 +07:00
commit fc850d1f6e
10 changed files with 48 additions and 46 deletions

View File

@ -47,6 +47,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[Priority(0)]
public async Task LanguageSet() public async Task LanguageSet()
{ {
var cul = _localization.GetCultureInfo(Context.Guild); var cul = _localization.GetCultureInfo(Context.Guild);
@ -57,6 +58,7 @@ namespace NadekoBot.Modules.Administration
[NadekoCommand, Usage, Description, Aliases] [NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[RequireUserPermission(GuildPermission.Administrator)] [RequireUserPermission(GuildPermission.Administrator)]
[Priority(1)]
public async Task LanguageSet(string name) public async Task LanguageSet(string name)
{ {
try try

View File

@ -35,7 +35,7 @@ namespace NadekoBot.Modules.Searches
.WithTitle(novelData.Title) .WithTitle(novelData.Title)
.WithUrl(novelData.Link) .WithUrl(novelData.Link)
.WithImageUrl(novelData.ImageUrl) .WithImageUrl(novelData.ImageUrl)
.AddField(efb => efb.WithName(GetText("authors")).WithValue(String.Join("\n", novelData.Authors)).WithIsInline(true)) .AddField(efb => efb.WithName(GetText("authors")).WithValue(string.Join("\n", novelData.Authors)).WithIsInline(true))
.AddField(efb => efb.WithName(GetText("status")).WithValue(novelData.Status).WithIsInline(true)) .AddField(efb => efb.WithName(GetText("status")).WithValue(novelData.Status).WithIsInline(true))
.AddField(efb => efb.WithName(GetText("genres")).WithValue(string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" })).WithIsInline(true)) .AddField(efb => efb.WithName(GetText("genres")).WithValue(string.Join(" ", novelData.Genres.Any() ? novelData.Genres : new[] { "none" })).WithIsInline(true))
.WithFooter(efb => efb.WithText(GetText("score") + " " + novelData.Score)); .WithFooter(efb => efb.WithText(GetText("score") + " " + novelData.Score));

View File

@ -67,6 +67,8 @@ namespace NadekoBot.Modules.Searches.Services
var document = await BrowsingContext.New(config).OpenAsync(link); var document = await BrowsingContext.New(config).OpenAsync(link);
var imageElem = document.QuerySelector("div.seriesimg > img"); var imageElem = document.QuerySelector("div.seriesimg > img");
if (imageElem == null)
return null;
var imageUrl = ((IHtmlImageElement)imageElem).Source; var imageUrl = ((IHtmlImageElement)imageElem).Source;
var descElem = document.QuerySelector("div#editdescription > p"); var descElem = document.QuerySelector("div#editdescription > p");

View File

@ -51,7 +51,6 @@ namespace NadekoBot.Modules.Searches.Services
public ConcurrentDictionary<ulong, Timer> AutoButtTimers { get; } = new ConcurrentDictionary<ulong, Timer>(); public ConcurrentDictionary<ulong, Timer> AutoButtTimers { get; } = new ConcurrentDictionary<ulong, Timer>();
private readonly ConcurrentDictionary<ulong, HashSet<string>> _blacklistedTags = new ConcurrentDictionary<ulong, HashSet<string>>(); private readonly ConcurrentDictionary<ulong, HashSet<string>> _blacklistedTags = new ConcurrentDictionary<ulong, HashSet<string>>();
private readonly Timer _t;
private readonly SemaphoreSlim _cryptoLock = new SemaphoreSlim(1, 1); private readonly SemaphoreSlim _cryptoLock = new SemaphoreSlim(1, 1);
public async Task<CryptoData[]> CryptoData() public async Task<CryptoData[]> CryptoData()
@ -132,22 +131,6 @@ namespace NadekoBot.Modules.Searches.Services
return Task.CompletedTask; return Task.CompletedTask;
}; };
if (client.ShardId == 0)
{
_t = new Timer(async _ =>
{
var r = _cache.Redis.GetDatabase();
try
{
}
catch (Exception ex)
{
_log.Warn(ex);
}
}, null, TimeSpan.Zero, TimeSpan.FromHours(1));
}
//joke commands //joke commands
if (File.Exists("data/wowjokes.json")) if (File.Exists("data/wowjokes.json"))
{ {

View File

@ -7,7 +7,7 @@
public object declined_since { get; set; } public object declined_since { get; set; }
public bool is_twitch_pledge { get; set; } public bool is_twitch_pledge { get; set; }
public bool patron_pays_fees { get; set; } public bool patron_pays_fees { get; set; }
public int pledge_cap_cents { get; set; } public int? pledge_cap_cents { get; set; }
} }
public class Address public class Address

View File

@ -118,7 +118,7 @@ namespace NadekoBot.Modules.Utility
[OwnerOnly] [OwnerOnly]
public async Task Activity(int page = 1) public async Task Activity(int page = 1)
{ {
const int activityPerPage = 15; const int activityPerPage = 10;
page -= 1; page -= 1;
if (page < 0) if (page < 0)

View File

@ -21,7 +21,7 @@ namespace NadekoBot.Core.Services.Impl
private readonly IBotCredentials _creds; private readonly IBotCredentials _creds;
private readonly DateTime _started; private readonly DateTime _started;
public const string BotVersion = "2.4.3"; public const string BotVersion = "2.4.4";
public string Author => "Kwoth#2560"; public string Author => "Kwoth#2560";
public string Library => "Discord.Net"; public string Library => "Discord.Net";

View File

@ -1,33 +1,43 @@
# NadekoBot a Discord bot # Setting up NadekoBot on Docker
Nadeko is written in C# and Discord.Net for more information visit <https://github.com/Kwoth/NadekoBot> Nadeko is written in C# and Discord.Net for more information visit <https://github.com/Kwoth/NadekoBot>
## Install Docker #### Prerequisites
Follow the respective guide for your operating system found here [Docker Engine Install Guide](https://docs.docker.com/engine/installation/) - [Docker](https://docs.docker.com/engine/installation/)
- [Create Discord Bot application](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#creating-discord-bot-application) and [Invite the bot to your server](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/#inviting-your-bot-to-your-server).
## Nadeko Setup Guide #### Setting up the container
For this guide we will be using the folder /nadeko as our config root folder. For this guide we will be using the folder /nadeko as our config root folder.
```
```bash
docker create --name=nadeko -v /nadeko/conf/:/root/nadeko -v /nadeko/data:/opt/NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.1/data uirel/nadeko:1.4 docker create --name=nadeko -v /nadeko/conf/:/root/nadeko -v /nadeko/data:/opt/NadekoBot/src/NadekoBot/bin/Release/netcoreapp1.1/data uirel/nadeko:1.4
``` ```
-If you are coming from a previous version of nadeko (the old docker) make sure your credentials.json has been copied into this directory and is the only thing in this folder.
-If you are making a fresh install, create your credentials.json from the following guide and place it in the /nadeko folder [Nadeko JSON Guide](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/) #### Moving `credentials.json` into the docker container.
Next start the docker up with `docker start nadeko; docker logs -f nadeko` - If you are coming from a previous version of nadeko (the old docker) make sure your credentials.json has been copied into this directory and is the only thing in this folder.
- If you are making a fresh install, create your credentials.json from the following guide and place it in the /nadeko folder [Nadeko JSON Guide](http://nadekobot.readthedocs.io/en/latest/JSON%20Explanations/).
- To copy the the file from your computer to a container:
```
docker cp /Directory/That/Contains/Your/credentials.json nadeko:/credentials.json
```
The docker will start and the log file will start scrolling past. Depending on hardware the bot start can take up to 5 minutes on a small DigitalOcean droplet. #### Start up docker
Once the log ends with "NadekoBot | Starting NadekoBot v1.0-rc2" the bot is ready and can be invited to your server. Ctrl+C at this point to stop viewing the logs. ```
docker start nadeko; docker logs -f nadeko
```
The docker will start and the log file will start scrolling past. This may take a long time. The bot start can take up to 5 minutes on a small DigitalOcean droplet.
Once the log ends with "NadekoBot | Starting NadekoBot vX.X" the bot is ready and can be invited to your server. Ctrl+C at this point if you would like to stop viewing the logs.
After a few moments you should be able to invite Nadeko to your server. If you cannot, check the log file for errors. After a few moments, Nadeko should come online on your server. If it doesn't, check the log file for errors.
## Monitoring #### Monitoring
**To monitor the logs of the container in realtime**
```
docker logs -f nadeko
```
* Monitor the logs of the container in realtime `docker logs -f nadeko`. ### Updates
## Updates #### Manual
# Manual
Updates are handled by pulling the new layer of the Docker Container which contains a pre compiled update to Nadeko. Updates are handled by pulling the new layer of the Docker Container which contains a pre compiled update to Nadeko.
The following commands are required for the default options The following commands are required for the default options
@ -42,17 +52,17 @@ docker create --name=nadeko -v /nadeko/conf/:/root/nadeko -v /nadeko/data:/opt/N
`docker start nadeko` `docker start nadeko`
# Automatic Updates #### Automatic
Automatic update are now handled by WatchTower [WatchTower GitHub](https://github.com/CenturyLinkLabs/watchtower) Automatic update are handled by [WatchTower](https://github.com/CenturyLinkLabs/watchtower).
To setup WatchTower to keep Nadeko up-to-date for you with the default settings, use the following command To setup WatchTower to keep Nadeko up-to-date for you with the default settings, use the following command:
```bash ```bash
docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock centurylink/watchtower --cleanup nadeko docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock centurylink/watchtower --cleanup nadeko --interval 300
``` ```
This will check for updates to the docker every 5 minutes and update immediately. Alternatively using the `--interval X` command to change the interval, where X is the amount of time in seconds to wait. e.g 21600 for 6 hours. This will check for updates to the docker every 5 minutes and update immediately. To check in different intervals, change `X`. X is the amount of time, in seconds. (e.g 21600 for 6 hours)
### Additional Info
If you have any issues with the docker setup, please ask in #help channel on our [Discord server](https://discordapp.com/invite/nadekobot) but indicate you are using the docker. If you have any issues with the docker setup, please ask in #help channel on our [Discord server](https://discordapp.com/invite/nadekobot) but indicate you are using the docker.
For information about configuring your bot or its functionality, please check the [documentation](http://nadekobot.readthedocs.io/en/latest). For information about configuring your bot or its functionality, please check the [documentation](http://nadekobot.readthedocs.io/en/latest).

View File

@ -26,6 +26,8 @@ brew install libsodium
brew install tmux brew install tmux
brew install python brew install python
brew install youtube-dl brew install youtube-dl
brew install redis
brew services start redis
``` ```
#### Installing .NET Core SDK #### Installing .NET Core SDK

View File

@ -841,8 +841,10 @@
"xp_level_up_channel": "Congratulations {0}, You've reached level {1}!", "xp_level_up_channel": "Congratulations {0}, You've reached level {1}!",
"xp_level_up_dm": "Congratulations {0}, You've reached level {1} on {2} server!", "xp_level_up_dm": "Congratulations {0}, You've reached level {1} on {2} server!",
"xp_level_up_global": "Congratulations {0}, You've reached global level {1}!", "xp_level_up_global": "Congratulations {0}, You've reached global level {1}!",
"xp_role_reward_cleared": "Level {0} will no longer reward a role.", "xp_role_reward_cleared": "Reaching level {0} will no longer reward a role.",
"xp_role_reward_added": "Users who reach level {0} will receive {1} role.", "xp_role_reward_added": "Users who reach level {0} will receive {1} role.",
"xp_cur_reward_cleared": "Reaching level {0} will no longer reward any {1}.",
"xp_cur_reward_added": "Users who reach level {0} will receive {1}.",
"xp_role_rewards": "Role Rewards", "xp_role_rewards": "Role Rewards",
"xp_level_x": "Level {0}", "xp_level_x": "Level {0}",
"xp_no_role_rewards": "No role reward on this page.", "xp_no_role_rewards": "No role reward on this page.",
@ -922,5 +924,6 @@
"administration_self_assign_not_level": "That self-assignable role requires at least server level {0}.", "administration_self_assign_not_level": "That self-assignable role requires at least server level {0}.",
"administration_invalid": "Invalid / Can't be found ({0})", "administration_invalid": "Invalid / Can't be found ({0})",
"administration_mass_kill_in_progress": "Mass Banning and Blacklisting of {0} users is in progress...", "administration_mass_kill_in_progress": "Mass Banning and Blacklisting of {0} users is in progress...",
"administration_mass_kill_completed": "Mass Banning and Blacklisting of {0} users is complete." "administration_mass_kill_completed": "Mass Banning and Blacklisting of {0} users is complete.",
"searches_failed_finding_novel": "Can't find that novel. Make sure you've typed the exact full name, and that it exists on novelupdates.com"
} }