.reloadimages owner-only command added.
This commit is contained in:
parent
a728e6f670
commit
dcc2f8f9e0
@ -3,6 +3,7 @@ using Discord.Commands;
|
||||
using NadekoBot.Attributes;
|
||||
using NadekoBot.Extensions;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@ -168,6 +169,23 @@ namespace NadekoBot.Modules.Administration
|
||||
await Context.Channel.SendConfirmAsync("🆗").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task ReloadImages()
|
||||
{
|
||||
var channel = (ITextChannel)Context.Channel;
|
||||
|
||||
var msg = await Context.Channel.SendMessageAsync("Reloading Images...").ConfigureAwait(false);
|
||||
var sw = Stopwatch.StartNew();
|
||||
await NadekoBot.Images.Reload().ConfigureAwait(false);
|
||||
sw.Stop();
|
||||
await msg.ModifyAsync(x =>
|
||||
{
|
||||
x.Content = "✅ Images reloaded.";
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static UserStatus SettableUserStatusToUserStatus(SettableUserStatus sus)
|
||||
{
|
||||
switch (sus)
|
||||
|
@ -51,24 +51,27 @@ namespace NadekoBot.Modules.Games
|
||||
.SelectMany(c => c.GenerateCurrencyChannelIds.Select(obj => obj.ChannelId)));
|
||||
}
|
||||
|
||||
private static async Task PotentialFlowerGeneration(SocketMessage imsg)
|
||||
{
|
||||
try
|
||||
private static Task PotentialFlowerGeneration(SocketMessage imsg)
|
||||
{
|
||||
var msg = imsg as SocketUserMessage;
|
||||
if (msg == null || msg.IsAuthor() || msg.Author.IsBot)
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
|
||||
var channel = imsg.Channel as ITextChannel;
|
||||
if (channel == null)
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
|
||||
if (!generationChannels.Contains(channel.Id))
|
||||
return;
|
||||
return Task.CompletedTask;
|
||||
|
||||
var _ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var lastGeneration = lastGenerations.GetOrAdd(channel.Id, DateTime.MinValue);
|
||||
var rng = new NadekoRandom();
|
||||
|
||||
//todo i'm stupid :rofl: wtg kwoth. real async programming :100: :ok_hand: :100: :100: :thumbsup:
|
||||
if (DateTime.Now - TimeSpan.FromSeconds(NadekoBot.BotConfig.CurrencyGenerationCooldown) < lastGeneration) //recently generated in this channel, don't generate again
|
||||
return;
|
||||
|
||||
@ -106,7 +109,12 @@ namespace NadekoBot.Modules.Games
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
_log.Warn(ex);
|
||||
}
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -5621,6 +5621,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to reloadimages.
|
||||
/// </summary>
|
||||
public static string reloadimages_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("reloadimages_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reloads images bot is using. Safe to use even when bot is being used heavily..
|
||||
/// </summary>
|
||||
public static string reloadimages_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("reloadimages_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}reloadimages`.
|
||||
/// </summary>
|
||||
public static string reloadimages_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("reloadimages_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to remind.
|
||||
/// </summary>
|
||||
|
@ -3042,4 +3042,13 @@
|
||||
<data name="setmusicchannel_usage" xml:space="preserve">
|
||||
<value>`{0}smch`</value>
|
||||
</data>
|
||||
<data name="reloadimages_cmd" xml:space="preserve">
|
||||
<value>reloadimages</value>
|
||||
</data>
|
||||
<data name="reloadimages_desc" xml:space="preserve">
|
||||
<value>Reloads images bot is using. Safe to use even when bot is being used heavily.</value>
|
||||
</data>
|
||||
<data name="reloadimages_usage" xml:space="preserve">
|
||||
<value>`{0}reloadimages`</value>
|
||||
</data>
|
||||
</root>
|
Loading…
Reference in New Issue
Block a user