Cleanup, now compiles! :O
This commit is contained in:
@@ -27,43 +27,38 @@ namespace NadekoBot.Modules
|
||||
? CultureInfo.CurrentCulture
|
||||
: NadekoBot.Localization.GetCultureInfo(Context.Guild));
|
||||
}
|
||||
|
||||
public Task<IUserMessage> ConfirmLocalized(string titleKey, string textKey, string url = null, string footer = null)
|
||||
{
|
||||
var title = NadekoBot.ResponsesResourceManager.GetString(titleKey, cultureInfo);
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, cultureInfo);
|
||||
return Context.Channel.SendConfirmAsync(title, text, url, footer);
|
||||
}
|
||||
|
||||
public Task<IUserMessage> ConfirmLocalized(string textKey)
|
||||
{
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, cultureInfo);
|
||||
return Context.Channel.SendConfirmAsync(textKey);
|
||||
}
|
||||
|
||||
public Task<IUserMessage> ErrorLocalized(string titleKey, string textKey, string url = null, string footer = null)
|
||||
{
|
||||
var title = NadekoBot.ResponsesResourceManager.GetString(titleKey, cultureInfo);
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, cultureInfo);
|
||||
return Context.Channel.SendErrorAsync(title, text, url, footer);
|
||||
}
|
||||
|
||||
public Task<IUserMessage> ErrorLocalized(string textKey)
|
||||
{
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, cultureInfo);
|
||||
return Context.Channel.SendErrorAsync(textKey);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class NadekoSubmodule : NadekoModule
|
||||
{
|
||||
public NadekoSubmodule() : base(false)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class ModuleBaseExtensions
|
||||
{
|
||||
public static Task<IUserMessage> ConfirmLocalized(this NadekoModule module, string titleKey, string textKey, string url = null, string footer = null)
|
||||
{
|
||||
var title = NadekoBot.ResponsesResourceManager.GetString(titleKey, module.cultureInfo);
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, module.cultureInfo);
|
||||
return module.Context.Channel.SendConfirmAsync(title, text, url, footer);
|
||||
}
|
||||
|
||||
public static Task<IUserMessage> ConfirmLocalized(this NadekoModule module, string textKey)
|
||||
{
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, module.cultureInfo);
|
||||
return module.Context.Channel.SendConfirmAsync(textKey);
|
||||
}
|
||||
|
||||
public static Task<IUserMessage> ErrorLocalized(this NadekoModule module, string titleKey, string textKey, string url = null, string footer = null)
|
||||
{
|
||||
var title = NadekoBot.ResponsesResourceManager.GetString(titleKey, module.cultureInfo);
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, module.cultureInfo);
|
||||
return module.Context.Channel.SendErrorAsync(title, text, url, footer);
|
||||
}
|
||||
|
||||
public static Task<IUserMessage> ErrorLocalized(this NadekoModule module, string textKey)
|
||||
{
|
||||
var text = NadekoBot.ResponsesResourceManager.GetString(textKey, module.cultureInfo);
|
||||
return module.Context.Channel.SendErrorAsync(textKey);
|
||||
}
|
||||
}
|
||||
}
|
15
src/NadekoBot/Modules/NadekoModuleExtensions.cs
Normal file
15
src/NadekoBot/Modules/NadekoModuleExtensions.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using Discord;
|
||||
using NadekoBot.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules
|
||||
{
|
||||
public static class NadekoModuleExtensions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@@ -12,6 +12,8 @@ using System;
|
||||
using Newtonsoft.Json;
|
||||
using System.IO;
|
||||
using System.Collections.Concurrent;
|
||||
using NadekoBot.Modules;
|
||||
using NadekoBot.Resources;
|
||||
|
||||
namespace NadekoBot.Modules.Pokemon
|
||||
{
|
||||
@@ -105,12 +107,12 @@ namespace NadekoBot.Modules.Pokemon
|
||||
|
||||
if (targetUser == null)
|
||||
{
|
||||
await ReplyLocalized("no user found").ConfigureAwait(false);
|
||||
await ErrorLocalized(nameof(ResponseStrings.Culture)).ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
else if (targetUser == user)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync("You can't attack yourself.").ConfigureAwait(false);
|
||||
await ErrorLocalized("You can't attack yourself.").ConfigureAwait(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user