Merge branch 'wip' of https://github.com/kwoth/nadekobot into wip
This commit is contained in:
commit
aca03cdc01
@ -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
|
||||||
|
@ -26,7 +26,7 @@ namespace NadekoBot.Modules.Searches
|
|||||||
|
|
||||||
if (novelData == null)
|
if (novelData == null)
|
||||||
{
|
{
|
||||||
await ReplyErrorLocalized("error_finding_novel").ConfigureAwait(false);
|
await ReplyErrorLocalized("failed_finding_novel").ConfigureAwait(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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));
|
||||||
|
@ -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");
|
||||||
|
@ -51,12 +51,29 @@ 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);
|
||||||
public async Task<CryptoData[]> CryptoData()
|
public async Task<CryptoData[]> CryptoData()
|
||||||
{
|
{
|
||||||
var data = await _cache.Redis.GetDatabase()
|
string data;
|
||||||
.StringGetAsync("crypto_data").ConfigureAwait(false);
|
var r = _cache.Redis.GetDatabase();
|
||||||
|
await _cryptoLock.WaitAsync().ConfigureAwait(false);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data = await r.StringGetAsync("crypto_data").ConfigureAwait(false);
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
data = await Http.GetStringAsync("https://api.coinmarketcap.com/v1/ticker/")
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
|
await r.StringSetAsync("crypto_data", data, TimeSpan.FromHours(1)).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_cryptoLock.Release();
|
||||||
|
}
|
||||||
|
|
||||||
return JsonConvert.DeserializeObject<CryptoData[]>(data);
|
return JsonConvert.DeserializeObject<CryptoData[]>(data);
|
||||||
}
|
}
|
||||||
@ -114,29 +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
|
|
||||||
{
|
|
||||||
var data = (string)(await r.StringGetAsync("crypto_data").ConfigureAwait(false));
|
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
data = await Http.GetStringAsync("https://api.coinmarketcap.com/v1/ticker/")
|
|
||||||
.ConfigureAwait(false);
|
|
||||||
|
|
||||||
await r.StringSetAsync("crypto_data", data, TimeSpan.FromHours(6)).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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"))
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
@ -24,7 +24,7 @@ namespace NadekoBot.Core.Services.Impl
|
|||||||
static Localization()
|
static Localization()
|
||||||
{
|
{
|
||||||
_commandData = JsonConvert.DeserializeObject<Dictionary<string, CommandData>>(
|
_commandData = JsonConvert.DeserializeObject<Dictionary<string, CommandData>>(
|
||||||
File.ReadAllText("./data/command_strings.json"));
|
File.ReadAllText("./_strings/cmd/command_strings.json"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Localization() { }
|
private Localization() { }
|
||||||
|
@ -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.3.6";
|
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";
|
||||||
|
@ -21,6 +21,7 @@ DisableWelcomePage=no
|
|||||||
[Files]
|
[Files]
|
||||||
;install
|
;install
|
||||||
Source: "src\NadekoBot\bin\Release\netcoreapp2.0\{#target}\publish\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db"
|
Source: "src\NadekoBot\bin\Release\netcoreapp2.0\{#target}\publish\*"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: recursesubdirs onlyifdoesntexist ignoreversion createallsubdirs; Excludes: "*.pdb, *.db"
|
||||||
|
Source: "src\NadekoBot\bin\Release\netcoreapp2.0\{#target}\publish\data\command_strings.json"; DestDir: "{app}\{#sysfolder}\data"; DestName: "command_strings.json"; Permissions: users-full; Flags: skipifsourcedoesntexist ignoreversion createallsubdirs recursesubdirs;
|
||||||
;rename credentials example to credentials, but don't overwrite if it exists
|
;rename credentials example to credentials, but don't overwrite if it exists
|
||||||
;Source: "src\NadekoBot\bin\Release\netcoreapp2.0\{#target}\publish\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist;
|
;Source: "src\NadekoBot\bin\Release\netcoreapp2.0\{#target}\publish\credentials_example.json"; DestName: "credentials.json"; DestDir: "{app}\{#sysfolder}"; Permissions: users-full; Flags: skipifsourcedoesntexist onlyifdoesntexist;
|
||||||
|
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
appveyor-retry dotnet restore NadekoBot.sln -v Minimal /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
||||||
dotnet build NadekoBot.sln -c "Release" /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
2
pack.ps1
2
pack.ps1
@ -1,2 +0,0 @@
|
|||||||
dotnet pack "src\NadekoBot\NadekoBot.csproj" -c "Release" -o "../../artifacts" --no-build --version-suffix "$Env:BUILD" /p:BuildNumber="$Env:BUILD" /p:IsTagBuild="$Env:APPVEYOR_REPO_TAG"
|
|
||||||
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
|
|
@ -23,7 +23,7 @@
|
|||||||
<None Update="data\**\*">
|
<None Update="data\**\*">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="_strings\*">
|
<None Update="_strings\**">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Update="libsodium.dll;opus.dll;libsodium.so;libopus.so">
|
<None Update="libsodium.dll;opus.dll;libsodium.so;libopus.so">
|
||||||
|
@ -925,5 +925,5 @@
|
|||||||
"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_error_finding_novel": "Can't find that novel. Make sure you've typed the exact full name, and that it exists on novelupdates.com"
|
"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"
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user