mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
- Removed NadekoCommand and Aliases attribute from all commands
- All commands must be marked as partial - Added [Cmd] Attribute to all commands - Cmd Attribute comes from the source generator which adds [NadekoCommand] and [Aliases] Attribute to each command - Should be updated in the future probably to be more performant and maybe add extra data to the commands - Started reorganizing modules and submodules
This commit is contained in:
343
src/NadekoBot.Generators/Command/CommandAttributesGenerator.cs
Normal file
343
src/NadekoBot.Generators/Command/CommandAttributesGenerator.cs
Normal file
@@ -0,0 +1,343 @@
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.CodeAnalysis.Text;
|
||||
|
||||
namespace NadekoBot.Generators.Command;
|
||||
|
||||
[Generator]
|
||||
public class CommandAttributesGenerator : IIncrementalGenerator
|
||||
{
|
||||
public const string ATTRIBUTE = @"// <AutoGenerated />
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
[System.AttributeUsage(System.AttributeTargets.Method)]
|
||||
public class CmdAttribute : System.Attribute
|
||||
{
|
||||
|
||||
}";
|
||||
|
||||
public class MethodModel
|
||||
{
|
||||
public string Namespace { get; set; }
|
||||
public IReadOnlyCollection<string> Classes { get; set; }
|
||||
public string ReturnType { get; set; }
|
||||
public string MethodName { get; set; }
|
||||
public IEnumerable<string> Params { get; set; }
|
||||
}
|
||||
|
||||
public class FileModel
|
||||
{
|
||||
public string Namespace { get; set; }
|
||||
public IReadOnlyCollection<string> ClassHierarchy { get; set; }
|
||||
public IReadOnlyCollection<MethodModel> Methods { get; set; }
|
||||
}
|
||||
|
||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||
{
|
||||
context.RegisterPostInitializationOutput(static ctx => ctx.AddSource(
|
||||
"CmdAttribute.g.cs",
|
||||
SourceText.From(ATTRIBUTE, Encoding.UTF8)));
|
||||
|
||||
var methods = context.SyntaxProvider
|
||||
.CreateSyntaxProvider(
|
||||
static (node, _) => node is MethodDeclarationSyntax { AttributeLists.Count: > 0 },
|
||||
static (ctx, cancel) => Transform(ctx, cancel))
|
||||
.Where(static m => m != default)
|
||||
.Where(static m => m.ChildTokens().Any(static x => x.IsKind(SyntaxKind.PublicKeyword)));
|
||||
|
||||
var compilationMethods = context.CompilationProvider.Combine(methods.Collect());
|
||||
|
||||
context.RegisterSourceOutput(compilationMethods,
|
||||
static (ctx, tuple) => RegisterAction(in ctx, tuple.Left, in tuple.Right));
|
||||
}
|
||||
|
||||
private static void RegisterAction(in SourceProductionContext ctx,
|
||||
Compilation comp,
|
||||
in ImmutableArray<MethodDeclarationSyntax> methods)
|
||||
{
|
||||
if (methods.IsDefaultOrEmpty)
|
||||
return;
|
||||
|
||||
var models = GetModels(comp, methods, ctx.CancellationToken);
|
||||
|
||||
foreach (var model in models)
|
||||
{
|
||||
var source = GetSourceText(model);
|
||||
ctx.AddSource($"{model.Namespace}.{string.Join(".", model.ClassHierarchy)}.g.cs",
|
||||
SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
}
|
||||
|
||||
// private static void GenerateFileFromModel(in SourceProductionContext ctx, IGrouping<string, DataModel> @group)
|
||||
// {
|
||||
// using var sw = new StringWriter();
|
||||
// using var tw = new IndentedTextWriter(sw);
|
||||
//
|
||||
// foreach (var model in group)
|
||||
// {
|
||||
// tw.WriteLine($"public partial {model.ReturnType} {model.MethodName}({string.Join(", ", model.Params)});");
|
||||
// }
|
||||
//
|
||||
// GenerateFileFromModel(ctx, sw.ToString(), group.Key, group.AsEnumerable());
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
// private static void GenerateFileFromModel(SourceProductionContext ctx, string innerContent, string groupName, IEnumerable<DataModel> modelsEnum)
|
||||
// {
|
||||
// using var sw = new StringWriter();
|
||||
// using var tw = new IndentedTextWriter(sw);
|
||||
//
|
||||
// var models = modelsEnum.ToList();
|
||||
// var referenceModel = models.First();
|
||||
// tw.WriteLine($"namespace {referenceModel.Namespace};");
|
||||
//
|
||||
// foreach (var className in referenceModel.ClassNames.Reverse().ToList())
|
||||
// {
|
||||
// tw.WriteLine($"public partial class {className}");
|
||||
// tw.WriteLine("{");
|
||||
// tw.WriteLine();
|
||||
// tw.Indent ++;
|
||||
// }
|
||||
//
|
||||
// foreach (var model in models)
|
||||
// {
|
||||
// tw.WriteLine($"public partial {model.ReturnType} {model.MethodName}({string.Join(", ", model.Params)});");
|
||||
// }
|
||||
//
|
||||
// foreach (var _ in referenceModel.ClassNames)
|
||||
// {
|
||||
// tw.Indent --;
|
||||
// tw.WriteLine("}");
|
||||
// }
|
||||
//
|
||||
// // tw.Indent--;
|
||||
// // tw.WriteLine("}");
|
||||
// tw.Flush();
|
||||
//
|
||||
// ctx.AddSource($"{groupName}.qwertyus.g.cs",
|
||||
// SourceText.From(sw.ToString(), Encoding.UTF8));
|
||||
// }
|
||||
|
||||
private static string GetSourceText(FileModel model)
|
||||
{
|
||||
using var sw = new StringWriter();
|
||||
using var tw = new IndentedTextWriter(sw);
|
||||
|
||||
tw.WriteLine("// <AutoGenerated />");
|
||||
tw.WriteLine("#pragma warning disable CS1066");
|
||||
tw.WriteLine($"namespace {model.Namespace};");
|
||||
|
||||
foreach (var className in model.ClassHierarchy)
|
||||
{
|
||||
tw.WriteLine($"public partial class {className}");
|
||||
tw.Write("{");
|
||||
tw.Indent ++;
|
||||
}
|
||||
|
||||
foreach (var method in model.Methods)
|
||||
{
|
||||
tw.WriteLine();
|
||||
tw.WriteLine("[NadekoCommand]");
|
||||
tw.WriteLine("[Aliases]");
|
||||
tw.WriteLine($"public partial {method.ReturnType} {method.MethodName}({string.Join(", ", method.Params)});");
|
||||
}
|
||||
|
||||
foreach (var _ in model.ClassHierarchy)
|
||||
{
|
||||
tw.Indent --;
|
||||
tw.WriteLine("}");
|
||||
}
|
||||
|
||||
tw.Flush();
|
||||
return sw.ToString();
|
||||
}
|
||||
|
||||
private static IReadOnlyCollection<FileModel> GetModels(Compilation compilation,
|
||||
in ImmutableArray<MethodDeclarationSyntax> methods,
|
||||
CancellationToken cancel)
|
||||
{
|
||||
var models = new List<FileModel>();
|
||||
|
||||
var methodModels = methods.Select(x => MethodDeclarationToMethodModel(compilation, x));
|
||||
|
||||
var groups = methodModels
|
||||
.GroupBy(static x => $"{x.Namespace}.{string.Join(".", x.Classes)}");
|
||||
|
||||
foreach (var group in groups)
|
||||
{
|
||||
var elems = group.ToList();
|
||||
var model = new FileModel()
|
||||
{
|
||||
Methods = elems,
|
||||
Namespace = elems[0].Namespace,
|
||||
ClassHierarchy = elems[0].Classes
|
||||
};
|
||||
|
||||
models.Add(model);
|
||||
}
|
||||
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
private static MethodModel MethodDeclarationToMethodModel(Compilation comp, MethodDeclarationSyntax decl)
|
||||
{
|
||||
// SpinWait.SpinUntil(static () => Debugger.IsAttached);
|
||||
|
||||
var methodModel = new MethodModel();
|
||||
var semanticModel = comp.GetSemanticModel(decl.SyntaxTree);
|
||||
methodModel.Params = decl.ParameterList.Parameters
|
||||
.Select(p =>
|
||||
{
|
||||
var prefix = p.Modifiers.Any(static x => x.IsKind(SyntaxKind.ParamsKeyword))
|
||||
? "params "
|
||||
: string.Empty;
|
||||
|
||||
var type = semanticModel
|
||||
.GetTypeInfo(p.Type!)
|
||||
.Type!
|
||||
.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);
|
||||
|
||||
|
||||
var name = p.Identifier.Text;
|
||||
|
||||
var suffix = string.Empty;
|
||||
if (p.Default is not null)
|
||||
{
|
||||
if (p.Default.Value is LiteralExpressionSyntax)
|
||||
{
|
||||
suffix = " = " + p.Default.Value;
|
||||
}
|
||||
else if (p.Default.Value is MemberAccessExpressionSyntax maes)
|
||||
{
|
||||
var maesSemModel = comp.GetSemanticModel(maes.SyntaxTree);
|
||||
var sym = maesSemModel.GetSymbolInfo(maes.Name);
|
||||
if (sym.Symbol is null)
|
||||
{
|
||||
suffix = " = " + p.Default.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
suffix = " = " + sym.Symbol.ToDisplayString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $"{prefix}{type} {name}{suffix}";
|
||||
})
|
||||
.ToList();
|
||||
|
||||
methodModel.MethodName = decl.Identifier.Text;
|
||||
methodModel.ReturnType = decl.ReturnType.ToString();
|
||||
methodModel.Namespace = GetNamespace(decl);
|
||||
methodModel.Classes = GetClasses(decl);
|
||||
|
||||
return methodModel;
|
||||
}
|
||||
|
||||
// private static IEnumerable<string> GetParams(Compilation compilation, MethodDeclarationSyntax method)
|
||||
// {
|
||||
// var semModel = compilation.GetSemanticModel(method.SyntaxTree);
|
||||
// return method.ParameterList.Parameters.Select(p =>
|
||||
// {
|
||||
// var prefix = string.Empty;
|
||||
//
|
||||
// var typeSymbol = semModel.GetTypeInfo(p).Type;
|
||||
//
|
||||
// if (p.Modifiers.Any(static x => x.IsKind(SyntaxKind.ParamsKeyword)))
|
||||
// prefix += "params ";
|
||||
// return prefix + $"{typeSymbol?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {p.Identifier.ToString()}";
|
||||
// });
|
||||
// // foreach (var param in method.ParameterList.Parameters)
|
||||
// // {
|
||||
// // yield return param.ToString();
|
||||
// // }
|
||||
// }
|
||||
|
||||
//https://github.com/andrewlock/NetEscapades.EnumGenerators/blob/main/src/NetEscapades.EnumGenerators/EnumGenerator.cs
|
||||
static string GetNamespace(MethodDeclarationSyntax declarationSyntax)
|
||||
{
|
||||
// determine the namespace the class is declared in, if any
|
||||
var nameSpace = string.Empty;
|
||||
var parentOfInterest = declarationSyntax.Parent;
|
||||
while (parentOfInterest != null)
|
||||
{
|
||||
parentOfInterest = parentOfInterest.Parent;
|
||||
|
||||
if (parentOfInterest is BaseNamespaceDeclarationSyntax ns)
|
||||
{
|
||||
nameSpace = ns.Name.ToString();
|
||||
while (true)
|
||||
{
|
||||
if (ns.Parent is not NamespaceDeclarationSyntax parent)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
ns = parent;
|
||||
nameSpace = $"{ns.Name}.{nameSpace}";
|
||||
}
|
||||
|
||||
return nameSpace;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
static IReadOnlyCollection<string> GetClasses(MethodDeclarationSyntax declarationSyntax)
|
||||
{
|
||||
// determine the namespace the class is declared in, if any
|
||||
var classes = new LinkedList<string>();
|
||||
var parentOfInterest = declarationSyntax.Parent;
|
||||
while (parentOfInterest is not null)
|
||||
{
|
||||
if (parentOfInterest is ClassDeclarationSyntax cds)
|
||||
{
|
||||
classes.AddFirst(cds.Identifier.ToString());
|
||||
}
|
||||
|
||||
parentOfInterest = parentOfInterest.Parent;
|
||||
}
|
||||
|
||||
Debug.WriteLine($"Method {declarationSyntax.Identifier.Text} has {classes.Count} classes");
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
private static MethodDeclarationSyntax Transform(GeneratorSyntaxContext ctx, CancellationToken cancel)
|
||||
{
|
||||
var methodDecl = (MethodDeclarationSyntax)ctx.Node;
|
||||
|
||||
foreach (var attListSyntax in methodDecl.AttributeLists)
|
||||
{
|
||||
foreach (var attSyntax in attListSyntax.Attributes)
|
||||
{
|
||||
if (cancel.IsCancellationRequested)
|
||||
return default;
|
||||
|
||||
var symbol = ModelExtensions.GetSymbolInfo(ctx.SemanticModel, attSyntax).Symbol;
|
||||
if (symbol is not IMethodSymbol attSymbol)
|
||||
continue;
|
||||
|
||||
if (attSymbol.ContainingType.ToDisplayString() == "NadekoBot.Common.CmdAttribute")
|
||||
return methodDecl;
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>9</LangVersion>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@@ -345,3 +345,4 @@ resharper_csharp_wrap_before_first_type_parameter_constraint = true
|
||||
resharper_csharp_place_type_constraints_on_same_line = false
|
||||
resharper_csharp_wrap_before_extends_colon = true
|
||||
resharper_csharp_place_constructor_initializer_on_same_line = false
|
||||
resharper_force_attribute_style = separate
|
@@ -28,7 +28,7 @@ public sealed class Bot
|
||||
private readonly CommandService _commandService;
|
||||
private readonly DbService _db;
|
||||
private readonly IBotCredsProvider _credsProvider;
|
||||
private readonly InteractionService _interactionService;
|
||||
// private readonly InteractionService _interactionService;
|
||||
|
||||
public Bot(int shardId, int? totalShards)
|
||||
{
|
||||
@@ -57,7 +57,7 @@ public sealed class Bot
|
||||
|
||||
_commandService = new(new() { CaseSensitiveCommands = false, DefaultRunMode = RunMode.Sync });
|
||||
|
||||
_interactionService = new(Client.Rest);
|
||||
// _interactionService = new(Client.Rest);
|
||||
|
||||
#if GLOBAL_NADEKO || DEBUG
|
||||
Client.Log += Client_Log;
|
||||
@@ -85,7 +85,7 @@ public sealed class Bot
|
||||
.AddRedis(_creds.RedisOptions) // redis
|
||||
.AddSingleton(Client) // discord socket client
|
||||
.AddSingleton(_commandService)
|
||||
.AddSingleton(_interactionService)
|
||||
// .AddSingleton(_interactionService)
|
||||
.AddSingleton(this)
|
||||
.AddSingleton<ISeria, JsonSeria>()
|
||||
.AddSingleton<IPubSub, RedisPubSub>()
|
||||
@@ -287,8 +287,7 @@ public sealed class Bot
|
||||
await commandHandler.StartHandling();
|
||||
|
||||
await _commandService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||
await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||
await _interactionService.RegisterCommandsToGuildAsync(117523346618318850);
|
||||
// await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||
IsReady = true;
|
||||
_ = Task.Run(ExecuteReadySubscriptions);
|
||||
Log.Information("Shard {ShardId} ready", Client.ShardId);
|
||||
|
@@ -37,12 +37,11 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
public Administration(ImageOnlyChannelService imageOnly)
|
||||
=> _imageOnly = imageOnly;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.Administrator)]
|
||||
public async Task ImageOnlyChannel(StoopidTime time = null)
|
||||
[BotPerm(GuildPerm.ManageGuild)]
|
||||
public async partial Task ImageOnlyChannel(StoopidTime time = null)
|
||||
{
|
||||
var newValue = _imageOnly.ToggleImageOnlyChannel(ctx.Guild.Id, ctx.Channel.Id);
|
||||
if (newValue)
|
||||
@@ -51,18 +50,16 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await ReplyPendingLocalizedAsync(strs.imageonly_disable);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageChannels)]
|
||||
[BotPerm(ChannelPerm.ManageChannels)]
|
||||
public async Task Slowmode(StoopidTime time = null)
|
||||
public async partial Task Slowmode(StoopidTime time = null)
|
||||
{
|
||||
var seconds = (int?)time?.Time.TotalSeconds ?? 0;
|
||||
if (time is not null && (time.Time < TimeSpan.FromSeconds(0) || time.Time > TimeSpan.FromHours(6)))
|
||||
return;
|
||||
|
||||
|
||||
await ((ITextChannel)ctx.Channel).ModifyAsync(tcp =>
|
||||
{
|
||||
tcp.SlowModeInterval = seconds;
|
||||
@@ -71,13 +68,12 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(2)]
|
||||
public async Task Delmsgoncmd(List _)
|
||||
public async partial Task Delmsgoncmd(List _)
|
||||
{
|
||||
var guild = (SocketGuild)ctx.Guild;
|
||||
var (enabled, channels) = _service.GetDelMsgOnCmdData(ctx.Guild.Id);
|
||||
@@ -103,13 +99,12 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task Delmsgoncmd(Server _ = Server.Server)
|
||||
public async partial Task Delmsgoncmd(Server _ = Server.Server)
|
||||
{
|
||||
if (_service.ToggleDeleteMessageOnCommand(ctx.Guild.Id))
|
||||
{
|
||||
@@ -123,22 +118,20 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public Task Delmsgoncmd(Channel _, State s, ITextChannel ch)
|
||||
public partial Task Delmsgoncmd(Channel _, State s, ITextChannel ch)
|
||||
=> Delmsgoncmd(_, s, ch.Id);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task Delmsgoncmd(Channel _, State s, ulong? chId = null)
|
||||
public async partial Task Delmsgoncmd(Channel _, State s, ulong? chId = null)
|
||||
{
|
||||
var actualChId = chId ?? ctx.Channel.Id;
|
||||
await _service.SetDelMsgOnCmdState(ctx.Guild.Id, actualChId, s);
|
||||
@@ -151,78 +144,71 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await ReplyConfirmLocalizedAsync(strs.delmsg_channel_inherit);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.DeafenMembers)]
|
||||
[BotPerm(GuildPerm.DeafenMembers)]
|
||||
public async Task Deafen(params IGuildUser[] users)
|
||||
public async partial Task Deafen(params IGuildUser[] users)
|
||||
{
|
||||
await _service.DeafenUsers(true, users);
|
||||
await ReplyConfirmLocalizedAsync(strs.deafen);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.DeafenMembers)]
|
||||
[BotPerm(GuildPerm.DeafenMembers)]
|
||||
public async Task UnDeafen(params IGuildUser[] users)
|
||||
public async partial Task UnDeafen(params IGuildUser[] users)
|
||||
{
|
||||
await _service.DeafenUsers(false, users);
|
||||
await ReplyConfirmLocalizedAsync(strs.undeafen);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task DelVoiChanl([Leftover] IVoiceChannel voiceChannel)
|
||||
public async partial Task DelVoiChanl([Leftover] IVoiceChannel voiceChannel)
|
||||
{
|
||||
await voiceChannel.DeleteAsync();
|
||||
await ReplyConfirmLocalizedAsync(strs.delvoich(Format.Bold(voiceChannel.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task CreatVoiChanl([Leftover] string channelName)
|
||||
public async partial Task CreatVoiChanl([Leftover] string channelName)
|
||||
{
|
||||
var ch = await ctx.Guild.CreateVoiceChannelAsync(channelName);
|
||||
await ReplyConfirmLocalizedAsync(strs.createvoich(Format.Bold(ch.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task DelTxtChanl([Leftover] ITextChannel toDelete)
|
||||
public async partial Task DelTxtChanl([Leftover] ITextChannel toDelete)
|
||||
{
|
||||
await toDelete.DeleteAsync();
|
||||
await ReplyConfirmLocalizedAsync(strs.deltextchan(Format.Bold(toDelete.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task CreaTxtChanl([Leftover] string channelName)
|
||||
public async partial Task CreaTxtChanl([Leftover] string channelName)
|
||||
{
|
||||
var txtCh = await ctx.Guild.CreateTextChannelAsync(channelName);
|
||||
await ReplyConfirmLocalizedAsync(strs.createtextchan(Format.Bold(txtCh.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task SetTopic([Leftover] string topic = null)
|
||||
public async partial Task SetTopic([Leftover] string topic = null)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
topic ??= "";
|
||||
@@ -230,24 +216,22 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await ReplyConfirmLocalizedAsync(strs.set_topic);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task SetChanlName([Leftover] string name)
|
||||
public async partial Task SetChanlName([Leftover] string name)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
await channel.ModifyAsync(c => c.Name = name);
|
||||
await ReplyConfirmLocalizedAsync(strs.set_channel_name);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageChannels)]
|
||||
[BotPerm(GuildPerm.ManageChannels)]
|
||||
public async Task NsfwToggle()
|
||||
public async partial Task NsfwToggle()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
var isEnabled = channel.IsNsfw;
|
||||
@@ -260,19 +244,17 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await ReplyConfirmLocalizedAsync(strs.nsfw_set_true);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public Task Edit(ulong messageId, [Leftover] string text)
|
||||
public partial Task Edit(ulong messageId, [Leftover] string text)
|
||||
=> Edit((ITextChannel)ctx.Channel, messageId, text);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task Edit(ITextChannel channel, ulong messageId, [Leftover] string text)
|
||||
public async partial Task Edit(ITextChannel channel, ulong messageId, [Leftover] string text)
|
||||
{
|
||||
var userPerms = ((SocketGuildUser)ctx.User).GetPermissions(channel);
|
||||
var botPerms = ((SocketGuild)ctx.Guild).CurrentUser.GetPermissions(channel);
|
||||
@@ -291,18 +273,16 @@ public partial class Administration : NadekoModule<AdministrationService>
|
||||
await _service.EditMessage(ctx, channel, messageId, text);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
[BotPerm(ChannelPerm.ManageMessages)]
|
||||
public Task Delete(ulong messageId, StoopidTime time = null)
|
||||
public partial Task Delete(ulong messageId, StoopidTime time = null)
|
||||
=> Delete((ITextChannel)ctx.Channel, messageId, time);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Delete(ITextChannel channel, ulong messageId, StoopidTime time = null)
|
||||
public async partial Task Delete(ITextChannel channel, ulong messageId, StoopidTime time = null)
|
||||
=> await InternalMessageAction(channel, messageId, time, msg => msg.DeleteAsync());
|
||||
|
||||
private async Task InternalMessageAction(
|
||||
|
@@ -6,14 +6,13 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class AutoAssignRoleCommands : NadekoSubmodule<AutoAssignRoleService>
|
||||
public partial class AutoAssignRoleCommands : NadekoSubmodule<AutoAssignRoleService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task AutoAssignRole([Leftover] IRole role)
|
||||
public async partial Task AutoAssignRole([Leftover] IRole role)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
if (role.Id == ctx.Guild.EveryoneRole.Id)
|
||||
@@ -35,12 +34,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.aar_role_removed(Format.Bold(role.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task AutoAssignRole()
|
||||
public async partial Task AutoAssignRole()
|
||||
{
|
||||
if (!_service.TryGetRoles(ctx.Guild.Id, out var roles))
|
||||
{
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
[Group]
|
||||
[OwnerOnly]
|
||||
public class DangerousCommands : NadekoSubmodule<DangerousCommandsService>
|
||||
public partial class DangerousCommands : NadekoSubmodule<DangerousCommandsService>
|
||||
{
|
||||
private async Task InternalExecSql(string sql, params object[] reps)
|
||||
{
|
||||
@@ -31,10 +31,9 @@ namespace NadekoBot.Modules.Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task SqlSelect([Leftover] string sql)
|
||||
public partial Task SqlSelect([Leftover] string sql)
|
||||
{
|
||||
var result = _service.SelectSql(sql);
|
||||
|
||||
@@ -56,52 +55,44 @@ namespace NadekoBot.Modules.Administration
|
||||
20);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task SqlExec([Leftover] string sql)
|
||||
public partial Task SqlExec([Leftover] string sql)
|
||||
=> InternalExecSql(sql);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteWaifus()
|
||||
public partial Task DeleteWaifus()
|
||||
=> SqlExec(DangerousCommandsService.WaifusDeleteSql);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteWaifu(IUser user)
|
||||
public partial Task DeleteWaifu(IUser user)
|
||||
=> DeleteWaifu(user.Id);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteWaifu(ulong userId)
|
||||
public partial Task DeleteWaifu(ulong userId)
|
||||
=> InternalExecSql(DangerousCommandsService.WaifuDeleteSql, userId);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteCurrency()
|
||||
public partial Task DeleteCurrency()
|
||||
=> SqlExec(DangerousCommandsService.CurrencyDeleteSql);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeletePlaylists()
|
||||
public partial Task DeletePlaylists()
|
||||
=> SqlExec(DangerousCommandsService.MusicPlaylistDeleteSql);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task DeleteXp()
|
||||
public partial Task DeleteXp()
|
||||
=> SqlExec(DangerousCommandsService.XpDeleteSql);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task PurgeUser(ulong userId)
|
||||
public async partial Task PurgeUser(ulong userId)
|
||||
{
|
||||
var embed = _eb.Create()
|
||||
.WithDescription(GetText(strs.purge_user_confirm(Format.Bold(userId.ToString()))));
|
||||
@@ -112,14 +103,13 @@ namespace NadekoBot.Modules.Administration
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task PurgeUser([Leftover] IUser user)
|
||||
public partial Task PurgeUser([Leftover] IUser user)
|
||||
=> PurgeUser(user.Id);
|
||||
//[NadekoCommand, Usage, Description, Aliases]
|
||||
//[OwnerOnly]
|
||||
//public Task DeleteUnusedCrnQ() =>
|
||||
//public partial Task DeleteUnusedCrnQ() =>
|
||||
// SqlExec(DangerousCommandsService.DeleteUnusedCustomReactionsAndQuotes);
|
||||
}
|
||||
}
|
@@ -6,14 +6,13 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class GameChannelCommands : NadekoSubmodule<GameVoiceChannelService>
|
||||
public partial class GameVoiceChannelCommands : NadekoSubmodule<GameVoiceChannelService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.MoveMembers)]
|
||||
public async Task GameVoiceChannel()
|
||||
public async partial Task GameVoiceChannel()
|
||||
{
|
||||
var vch = ((IGuildUser)ctx.User).VoiceChannel;
|
||||
|
@@ -3,13 +3,12 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class ServerGreetCommands : NadekoSubmodule<GreetSettingsService>
|
||||
public partial class GreetCommands : NadekoSubmodule<GreetService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task Boost()
|
||||
public async partial Task Boost()
|
||||
{
|
||||
var enabled = await _service.ToggleBoost(ctx.Guild.Id, ctx.Channel.Id);
|
||||
|
||||
@@ -19,11 +18,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.boost_off);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task BoostDel(int timer = 30)
|
||||
public async partial Task BoostDel(int timer = 30)
|
||||
{
|
||||
if (timer is < 0 or > 600)
|
||||
return;
|
||||
@@ -36,11 +34,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.boostdel_off);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task BoostMsg([Leftover] string? text = null)
|
||||
public async partial Task BoostMsg([Leftover] string? text = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
@@ -56,11 +53,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.boostmsg_enable($"`{Prefix}boost`"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task GreetDel(int timer = 30)
|
||||
public async partial Task GreetDel(int timer = 30)
|
||||
{
|
||||
if (timer is < 0 or > 600)
|
||||
return;
|
||||
@@ -73,11 +69,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.greetdel_off);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task Greet()
|
||||
public async partial Task Greet()
|
||||
{
|
||||
var enabled = await _service.SetGreet(ctx.Guild.Id, ctx.Channel.Id);
|
||||
|
||||
@@ -87,11 +82,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.greet_off);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task GreetMsg([Leftover] string? text = null)
|
||||
public async partial Task GreetMsg([Leftover] string? text = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
@@ -108,11 +102,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task GreetDm()
|
||||
public async partial Task GreetDm()
|
||||
{
|
||||
var enabled = await _service.SetGreetDm(ctx.Guild.Id);
|
||||
|
||||
@@ -122,11 +115,10 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.greetdm_off);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task GreetDmMsg([Leftover] string? text = null)
|
||||
public async partial Task GreetDmMsg([Leftover] string? text = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
@@ -142,11 +134,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.greetdmmsg_enable($"`{Prefix}greetdm`"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task Bye()
|
||||
public async partial Task Bye()
|
||||
{
|
||||
var enabled = await _service.SetBye(ctx.Guild.Id, ctx.Channel.Id);
|
||||
|
||||
@@ -156,11 +147,10 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.bye_off);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task ByeMsg([Leftover] string? text = null)
|
||||
public async partial Task ByeMsg([Leftover] string? text = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
{
|
||||
@@ -176,11 +166,10 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
public async Task ByeDel(int timer = 30)
|
||||
public async partial Task ByeDel(int timer = 30)
|
||||
{
|
||||
await _service.SetByeDel(ctx.Guild.Id, timer);
|
||||
|
||||
@@ -191,12 +180,11 @@ public partial class Administration
|
||||
}
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
[Ratelimit(5)]
|
||||
public async Task ByeTest([Leftover] IGuildUser? user = null)
|
||||
public async partial Task ByeTest([Leftover] IGuildUser? user = null)
|
||||
{
|
||||
user ??= (IGuildUser)ctx.User;
|
||||
|
||||
@@ -205,12 +193,11 @@ public partial class Administration
|
||||
if (!enabled) await ReplyPendingLocalizedAsync(strs.byemsg_enable($"`{Prefix}bye`"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
[Ratelimit(5)]
|
||||
public async Task GreetTest([Leftover] IGuildUser? user = null)
|
||||
public async partial Task GreetTest([Leftover] IGuildUser? user = null)
|
||||
{
|
||||
user ??= (IGuildUser)ctx.User;
|
||||
|
||||
@@ -219,12 +206,11 @@ public partial class Administration
|
||||
if (!enabled) await ReplyPendingLocalizedAsync(strs.greetmsg_enable($"`{Prefix}greet`"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageGuild)]
|
||||
[Ratelimit(5)]
|
||||
public async Task GreetDmTest([Leftover] IGuildUser? user = null)
|
||||
public async partial Task GreetDmTest([Leftover] IGuildUser? user = null)
|
||||
{
|
||||
user ??= (IGuildUser)ctx.User;
|
||||
|
@@ -3,7 +3,7 @@ using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Services;
|
||||
|
||||
public class GreetSettingsService : INService
|
||||
public class GreetService : INService
|
||||
{
|
||||
public bool GroupGreets
|
||||
=> _bss.Data.GroupGreets;
|
||||
@@ -17,7 +17,7 @@ public class GreetSettingsService : INService
|
||||
private readonly GreetGrouper<IUser> _byes = new();
|
||||
private readonly BotConfigService _bss;
|
||||
|
||||
public GreetSettingsService(
|
||||
public GreetService(
|
||||
DiscordSocketClient client,
|
||||
Bot bot,
|
||||
DbService db,
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class LocalizationCommands : NadekoSubmodule
|
||||
public partial class LocalizationCommands : NadekoSubmodule
|
||||
{
|
||||
private static readonly IReadOnlyDictionary<string, string> supportedLocales = new Dictionary<string, string>
|
||||
{
|
||||
@@ -38,20 +38,18 @@ public partial class Administration
|
||||
{ "uk-UA", "Українська, Україна" }
|
||||
};
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task LanguageSet()
|
||||
public async partial Task LanguageSet()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.lang_set_show(Format.Bold(Culture.ToString()),
|
||||
Format.Bold(Culture.NativeName)));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(1)]
|
||||
public async Task LanguageSet(string name)
|
||||
public async partial Task LanguageSet(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -75,18 +73,16 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task LanguageSetDefault()
|
||||
[Cmd]
|
||||
public async partial Task LanguageSetDefault()
|
||||
{
|
||||
var cul = Localization.DefaultCultureInfo;
|
||||
await ReplyErrorLocalizedAsync(strs.lang_set_bot_show(cul, cul.NativeName));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task LanguageSetDefault(string name)
|
||||
public async partial Task LanguageSetDefault(string name)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -111,9 +107,8 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task LanguagesList()
|
||||
[Cmd]
|
||||
public async partial Task LanguagesList()
|
||||
=> await ctx.Channel.EmbedAsync(_eb.Create()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText(strs.lang_list))
|
||||
|
@@ -1,167 +0,0 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Common.TypeReaders.Models;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Modules.Administration;
|
||||
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
[NoPublicBot]
|
||||
public class LogCommands : NadekoSubmodule<ILogCommandService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogServer(PermissionAction action)
|
||||
{
|
||||
await _service.LogServer(ctx.Guild.Id, ctx.Channel.Id, action.Value);
|
||||
if (action.Value)
|
||||
await ReplyConfirmLocalizedAsync(strs.log_all);
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.log_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogIgnore()
|
||||
{
|
||||
var settings = _service.GetGuildLogSettings(ctx.Guild.Id);
|
||||
|
||||
var chs = settings?.LogIgnores.Where(x => x.ItemType == IgnoredItemType.Channel).ToList()
|
||||
?? new List<IgnoredLogItem>();
|
||||
var usrs = settings?.LogIgnores.Where(x => x.ItemType == IgnoredItemType.User).ToList()
|
||||
?? new List<IgnoredLogItem>();
|
||||
|
||||
var eb = _eb.Create(ctx)
|
||||
.WithOkColor()
|
||||
.AddField(GetText(strs.log_ignored_channels),
|
||||
chs.Count == 0
|
||||
? "-"
|
||||
: string.Join('\n', chs.Select(x => $"{x.LogItemId} | <#{x.LogItemId}>")))
|
||||
.AddField(GetText(strs.log_ignored_users),
|
||||
usrs.Count == 0
|
||||
? "-"
|
||||
: string.Join('\n', usrs.Select(x => $"{x.LogItemId} | <@{x.LogItemId}>")));
|
||||
|
||||
await ctx.Channel.EmbedAsync(eb);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogIgnore([Leftover] ITextChannel target)
|
||||
{
|
||||
target ??= (ITextChannel)ctx.Channel;
|
||||
|
||||
var removed = _service.LogIgnore(ctx.Guild.Id, target.Id, IgnoredItemType.Channel);
|
||||
|
||||
if (!removed)
|
||||
await ReplyConfirmLocalizedAsync(
|
||||
strs.log_ignore_chan(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(
|
||||
strs.log_not_ignore_chan(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogIgnore([Leftover] IUser target)
|
||||
{
|
||||
var removed = _service.LogIgnore(ctx.Guild.Id, target.Id, IgnoredItemType.User);
|
||||
|
||||
if (!removed)
|
||||
await ReplyConfirmLocalizedAsync(
|
||||
strs.log_ignore_user(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(
|
||||
strs.log_not_ignore_user(Format.Bold(target.Mention + "(" + target.Id + ")")));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task LogEvents()
|
||||
{
|
||||
var logSetting = _service.GetGuildLogSettings(ctx.Guild.Id);
|
||||
var str = string.Join("\n",
|
||||
Enum.GetNames(typeof(LogType))
|
||||
.Select(x =>
|
||||
{
|
||||
var val = logSetting is null ? null : GetLogProperty(logSetting, Enum.Parse<LogType>(x));
|
||||
if (val != null)
|
||||
return $"{Format.Bold(x)} <#{val}>";
|
||||
return Format.Bold(x);
|
||||
}));
|
||||
|
||||
await SendConfirmAsync(Format.Bold(GetText(strs.log_events)) + "\n" + str);
|
||||
}
|
||||
|
||||
private static ulong? GetLogProperty(LogSetting l, LogType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case LogType.Other:
|
||||
return l.LogOtherId;
|
||||
case LogType.MessageUpdated:
|
||||
return l.MessageUpdatedId;
|
||||
case LogType.MessageDeleted:
|
||||
return l.MessageDeletedId;
|
||||
case LogType.UserJoined:
|
||||
return l.UserJoinedId;
|
||||
case LogType.UserLeft:
|
||||
return l.UserLeftId;
|
||||
case LogType.UserBanned:
|
||||
return l.UserBannedId;
|
||||
case LogType.UserUnbanned:
|
||||
return l.UserUnbannedId;
|
||||
case LogType.UserUpdated:
|
||||
return l.UserUpdatedId;
|
||||
case LogType.ChannelCreated:
|
||||
return l.ChannelCreatedId;
|
||||
case LogType.ChannelDestroyed:
|
||||
return l.ChannelDestroyedId;
|
||||
case LogType.ChannelUpdated:
|
||||
return l.ChannelUpdatedId;
|
||||
case LogType.UserPresence:
|
||||
return l.LogUserPresenceId;
|
||||
case LogType.VoicePresence:
|
||||
return l.LogVoicePresenceId;
|
||||
case LogType.VoicePresenceTTS:
|
||||
return l.LogVoicePresenceTTSId;
|
||||
case LogType.UserMuted:
|
||||
return l.UserMutedId;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task Log(LogType type)
|
||||
{
|
||||
var val = _service.Log(ctx.Guild.Id, ctx.Channel.Id, type);
|
||||
|
||||
if (val)
|
||||
await ReplyConfirmLocalizedAsync(strs.log(Format.Bold(type.ToString())));
|
||||
else
|
||||
await ReplyConfirmLocalizedAsync(strs.log_stop(Format.Bold(type.ToString())));
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class MuteCommands : NadekoSubmodule<MuteService>
|
||||
public partial class MuteCommands : NadekoSubmodule<MuteService>
|
||||
{
|
||||
private async Task<bool> VerifyMutePermissions(IGuildUser runnerUser, IGuildUser targetUser)
|
||||
{
|
||||
@@ -23,11 +23,10 @@ public partial class Administration
|
||||
return true;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
public async Task MuteRole([Leftover] IRole role = null)
|
||||
public async partial Task MuteRole([Leftover] IRole role = null)
|
||||
{
|
||||
if (role is null)
|
||||
{
|
||||
@@ -48,12 +47,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.mute_role_set);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles | GuildPerm.MuteMembers)]
|
||||
[Priority(0)]
|
||||
public async Task Mute(IGuildUser target, [Leftover] string reason = "")
|
||||
public async partial Task Mute(IGuildUser target, [Leftover] string reason = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -70,12 +68,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles | GuildPerm.MuteMembers)]
|
||||
[Priority(1)]
|
||||
public async Task Mute(StoopidTime time, IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task Mute(StoopidTime time, IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
if (time.Time < TimeSpan.FromMinutes(1) || time.Time > TimeSpan.FromDays(49))
|
||||
return;
|
||||
@@ -95,11 +92,10 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles | GuildPerm.MuteMembers)]
|
||||
public async Task Unmute(IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task Unmute(IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -112,12 +108,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(0)]
|
||||
public async Task ChatMute(IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task ChatMute(IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -134,12 +129,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(1)]
|
||||
public async Task ChatMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task ChatMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
if (time.Time < TimeSpan.FromMinutes(1) || time.Time > TimeSpan.FromDays(49))
|
||||
return;
|
||||
@@ -159,11 +153,10 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ChatUnmute(IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task ChatUnmute(IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -176,12 +169,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.MuteMembers)]
|
||||
[Priority(0)]
|
||||
public async Task VoiceMute(IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task VoiceMute(IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -197,12 +189,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.MuteMembers)]
|
||||
[Priority(1)]
|
||||
public async Task VoiceMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task VoiceMute(StoopidTime time, IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
if (time.Time < TimeSpan.FromMinutes(1) || time.Time > TimeSpan.FromDays(49))
|
||||
return;
|
||||
@@ -221,11 +212,10 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.MuteMembers)]
|
||||
public async Task VoiceUnmute(IGuildUser user, [Leftover] string reason = "")
|
||||
public async partial Task VoiceUnmute(IGuildUser user, [Leftover] string reason = "")
|
||||
{
|
||||
try
|
||||
{
|
@@ -7,15 +7,14 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class DiscordPermOverrideCommands : NadekoSubmodule<DiscordPermOverrideService>
|
||||
public partial class DiscordPermOverrideCommands : NadekoSubmodule<DiscordPermOverrideService>
|
||||
{
|
||||
// override stats, it should require that the user has managessages guild permission
|
||||
// .po 'stats' add user guild managemessages
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task DiscordPermOverride(CommandOrCrInfo cmd, params GuildPerm[] perms)
|
||||
public async partial Task DiscordPermOverride(CommandOrCrInfo cmd, params GuildPerm[] perms)
|
||||
{
|
||||
if (perms is null || perms.Length == 0)
|
||||
{
|
||||
@@ -31,11 +30,10 @@ public partial class Administration
|
||||
Format.Code(cmd.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task DiscordPermOverrideReset()
|
||||
public async partial Task DiscordPermOverrideReset()
|
||||
{
|
||||
var result = await PromptUserConfirmAsync(_eb.Create()
|
||||
.WithOkColor()
|
||||
@@ -48,11 +46,10 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.perm_override_all);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task DiscordPermOverrideList(int page = 1)
|
||||
public async partial Task DiscordPermOverrideList(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
@@ -6,12 +6,11 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class PlayingRotateCommands : NadekoSubmodule<PlayingRotateService>
|
||||
public partial class PlayingRotateCommands : NadekoSubmodule<PlayingRotateService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task RotatePlaying()
|
||||
public async partial Task RotatePlaying()
|
||||
{
|
||||
if (_service.ToggleRotatePlaying())
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_enabled);
|
||||
@@ -19,20 +18,18 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task AddPlaying(ActivityType t, [Leftover] string status)
|
||||
public async partial Task AddPlaying(ActivityType t, [Leftover] string status)
|
||||
{
|
||||
await _service.AddPlaying(t, status);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.ropl_added);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ListPlaying()
|
||||
public async partial Task ListPlaying()
|
||||
{
|
||||
var statuses = _service.GetRotatingStatuses();
|
||||
|
||||
@@ -48,10 +45,9 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task RemovePlaying(int index)
|
||||
public async partial Task RemovePlaying(int index)
|
||||
{
|
||||
index -= 1;
|
||||
|
@@ -4,33 +4,30 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class PrefixCommands : NadekoSubmodule
|
||||
public partial class PrefixCommands : NadekoSubmodule
|
||||
{
|
||||
public enum Set
|
||||
{
|
||||
Set
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task PrefixCommand()
|
||||
public async partial Task PrefixCommand()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.prefix_current(Format.Code(CmdHandler.GetPrefix(ctx.Guild))));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public Task PrefixCommand(Set _, [Leftover] string prefix)
|
||||
public partial Task PrefixCommand(Set _, [Leftover] string prefix)
|
||||
=> PrefixCommand(prefix);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public async Task PrefixCommand([Leftover] string prefix)
|
||||
public async partial Task PrefixCommand([Leftover] string prefix)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(prefix))
|
||||
return;
|
||||
@@ -41,10 +38,9 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.prefix_new(Format.Code(oldPrefix), Format.Code(newPrefix)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task DefPrefix([Leftover] string prefix = null)
|
||||
public async partial Task DefPrefix([Leftover] string prefix = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(prefix))
|
||||
{
|
||||
|
@@ -9,13 +9,12 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class ProtectionCommands : NadekoSubmodule<ProtectionService>
|
||||
public partial class ProtectionCommands : NadekoSubmodule<ProtectionService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AntiAlt()
|
||||
public async partial Task AntiAlt()
|
||||
{
|
||||
if (await _service.TryStopAntiAlt(ctx.Guild.Id))
|
||||
{
|
||||
@@ -26,11 +25,10 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.protection_not_running("Anti-Alt"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AntiAlt(StoopidTime minAge, PunishmentAction action, [Leftover] StoopidTime punishTime = null)
|
||||
public async partial Task AntiAlt(StoopidTime minAge, PunishmentAction action, [Leftover] StoopidTime punishTime = null)
|
||||
{
|
||||
var minAgeMinutes = (int)minAge.Time.TotalMinutes;
|
||||
var punishTimeMinutes = (int?)punishTime?.Time.TotalMinutes ?? 0;
|
||||
@@ -46,11 +44,10 @@ public partial class Administration
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AntiAlt(StoopidTime minAge, PunishmentAction action, [Leftover] IRole role)
|
||||
public async partial Task AntiAlt(StoopidTime minAge, PunishmentAction action, [Leftover] IRole role)
|
||||
{
|
||||
var minAgeMinutes = (int)minAge.Time.TotalMinutes;
|
||||
|
||||
@@ -62,35 +59,32 @@ public partial class Administration
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public Task AntiRaid()
|
||||
public partial Task AntiRaid()
|
||||
{
|
||||
if (_service.TryStopAntiRaid(ctx.Guild.Id))
|
||||
return ReplyConfirmLocalizedAsync(strs.prot_disable("Anti-Raid"));
|
||||
return ReplyPendingLocalizedAsync(strs.protection_not_running("Anti-Raid"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(1)]
|
||||
public Task AntiRaid(
|
||||
public partial Task AntiRaid(
|
||||
int userThreshold,
|
||||
int seconds,
|
||||
PunishmentAction action,
|
||||
[Leftover] StoopidTime punishTime)
|
||||
=> InternalAntiRaid(userThreshold, seconds, action, punishTime);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(2)]
|
||||
public Task AntiRaid(int userThreshold, int seconds, PunishmentAction action)
|
||||
public partial Task AntiRaid(int userThreshold, int seconds, PunishmentAction action)
|
||||
=> InternalAntiRaid(userThreshold, seconds, action);
|
||||
|
||||
private async Task InternalAntiRaid(
|
||||
@@ -133,23 +127,21 @@ public partial class Administration
|
||||
$"{ctx.User.Mention} {GetAntiRaidString(stats)}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public Task AntiSpam()
|
||||
public partial Task AntiSpam()
|
||||
{
|
||||
if (_service.TryStopAntiSpam(ctx.Guild.Id))
|
||||
return ReplyConfirmLocalizedAsync(strs.prot_disable("Anti-Spam"));
|
||||
return ReplyPendingLocalizedAsync(strs.protection_not_running("Anti-Spam"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] IRole role)
|
||||
public partial Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (action != PunishmentAction.AddRole)
|
||||
return Task.CompletedTask;
|
||||
@@ -157,23 +149,21 @@ public partial class Administration
|
||||
return InternalAntiSpam(messageCount, action, null, role);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(1)]
|
||||
public Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] StoopidTime punishTime)
|
||||
public partial Task AntiSpam(int messageCount, PunishmentAction action, [Leftover] StoopidTime punishTime)
|
||||
=> InternalAntiSpam(messageCount, action, punishTime);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(2)]
|
||||
public Task AntiSpam(int messageCount, PunishmentAction action)
|
||||
public partial Task AntiSpam(int messageCount, PunishmentAction action)
|
||||
=> InternalAntiSpam(messageCount, action);
|
||||
|
||||
public async Task InternalAntiSpam(
|
||||
private async Task InternalAntiSpam(
|
||||
int messageCount,
|
||||
PunishmentAction action,
|
||||
StoopidTime timeData = null,
|
||||
@@ -196,11 +186,10 @@ public partial class Administration
|
||||
$"{ctx.User.Mention} {GetAntiSpamString(stats)}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AntispamIgnore()
|
||||
public async partial Task AntispamIgnore()
|
||||
{
|
||||
var added = await _service.AntiSpamIgnoreAsync(ctx.Guild.Id, ctx.Channel.Id);
|
||||
|
||||
@@ -216,10 +205,9 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.spam_not_ignore("Anti-Spam"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AntiList()
|
||||
public async partial Task AntiList()
|
||||
{
|
||||
var (spam, raid, alt) = _service.GetAntiStats(ctx.Guild.Id);
|
||||
|
@@ -6,15 +6,14 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class PruneCommands : NadekoSubmodule<PruneService>
|
||||
public partial class PruneCommands : NadekoSubmodule<PruneService>
|
||||
{
|
||||
private static readonly TimeSpan twoWeeks = TimeSpan.FromDays(14);
|
||||
|
||||
//delets her own messages, no perm required
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Prune(string parameter = null)
|
||||
public async partial Task Prune(string parameter = null)
|
||||
{
|
||||
var user = await ctx.Guild.GetCurrentUserAsync();
|
||||
|
||||
@@ -26,13 +25,12 @@ public partial class Administration
|
||||
}
|
||||
|
||||
// prune x
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
[BotPerm(ChannelPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task Prune(int count, string parameter = null)
|
||||
public async partial Task Prune(int count, string parameter = null)
|
||||
{
|
||||
count++;
|
||||
if (count < 1)
|
||||
@@ -47,23 +45,21 @@ public partial class Administration
|
||||
}
|
||||
|
||||
//prune @user [x]
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
[BotPerm(ChannelPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public Task Prune(IGuildUser user, int count = 100, string parameter = null)
|
||||
public partial Task Prune(IGuildUser user, int count = 100, string parameter = null)
|
||||
=> Prune(user.Id, count, parameter);
|
||||
|
||||
//prune userid [x]
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
[BotPerm(ChannelPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public async Task Prune(ulong userId, int count = 100, string parameter = null)
|
||||
public async partial Task Prune(ulong userId, int count = 100, string parameter = null)
|
||||
{
|
||||
if (userId == ctx.User.Id)
|
||||
count++;
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Administration;
|
||||
|
||||
public partial class Administration
|
||||
{
|
||||
public class RoleCommands : NadekoSubmodule<RoleCommandsService>
|
||||
public partial class RoleCommands : NadekoSubmodule<RoleCommandsService>
|
||||
{
|
||||
public enum Exclude { Excl }
|
||||
|
||||
@@ -88,52 +88,47 @@ public partial class Administration
|
||||
await ReplyErrorLocalizedAsync(strs.reaction_roles_full);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NoPublicBot]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(0)]
|
||||
public Task ReactionRoles(ulong messageId, params string[] input)
|
||||
public partial Task ReactionRoles(ulong messageId, params string[] input)
|
||||
=> InternalReactionRoles(false, messageId, input);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NoPublicBot]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(1)]
|
||||
public Task ReactionRoles(ulong messageId, Exclude _, params string[] input)
|
||||
public partial Task ReactionRoles(ulong messageId, Exclude _, params string[] input)
|
||||
=> InternalReactionRoles(true, messageId, input);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NoPublicBot]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(0)]
|
||||
public Task ReactionRoles(params string[] input)
|
||||
public partial Task ReactionRoles(params string[] input)
|
||||
=> InternalReactionRoles(false, null, input);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NoPublicBot]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(1)]
|
||||
public Task ReactionRoles(Exclude _, params string[] input)
|
||||
public partial Task ReactionRoles(Exclude _, params string[] input)
|
||||
=> InternalReactionRoles(true, null, input);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NoPublicBot]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ReactionRolesList()
|
||||
public async partial Task ReactionRolesList()
|
||||
{
|
||||
var embed = _eb.Create().WithOkColor();
|
||||
if (!_service.Get(ctx.Guild.Id, out var rrs) || !rrs.Any())
|
||||
@@ -157,12 +152,11 @@ public partial class Administration
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NoPublicBot]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ReactionRolesRemove(int index)
|
||||
public async partial Task ReactionRolesRemove(int index)
|
||||
{
|
||||
if (index < 1 || !_service.Get(ctx.Guild.Id, out var rrs) || !rrs.Any() || rrs.Count < index)
|
||||
return;
|
||||
@@ -172,12 +166,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.reaction_role_removed(index + 1));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task SetRole(IGuildUser targetUser, [Leftover] IRole roleToAdd)
|
||||
public async partial Task SetRole(IGuildUser targetUser, [Leftover] IRole roleToAdd)
|
||||
{
|
||||
var runnerUser = (IGuildUser)ctx.User;
|
||||
var runnerMaxRolePosition = runnerUser.GetRoles().Max(x => x.Position);
|
||||
@@ -197,12 +190,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task RemoveRole(IGuildUser targetUser, [Leftover] IRole roleToRemove)
|
||||
public async partial Task RemoveRole(IGuildUser targetUser, [Leftover] IRole roleToRemove)
|
||||
{
|
||||
var runnerUser = (IGuildUser)ctx.User;
|
||||
if (ctx.User.Id != runnerUser.Guild.OwnerId
|
||||
@@ -220,12 +212,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task RenameRole(IRole roleToEdit, [Leftover] string newname)
|
||||
public async partial Task RenameRole(IRole roleToEdit, [Leftover] string newname)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= roleToEdit.Position)
|
||||
@@ -247,12 +238,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task RemoveAllRoles([Leftover] IGuildUser user)
|
||||
public async partial Task RemoveAllRoles([Leftover] IGuildUser user)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
|
||||
@@ -273,12 +263,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task CreateRole([Leftover] string roleName = null)
|
||||
public async partial Task CreateRole([Leftover] string roleName = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(roleName))
|
||||
return;
|
||||
@@ -287,12 +276,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.cr(Format.Bold(r.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task DeleteRole([Leftover] IRole role)
|
||||
public async partial Task DeleteRole([Leftover] IRole role)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position)
|
||||
@@ -302,12 +290,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.dr(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task RoleHoist(IRole role)
|
||||
public async partial Task RoleHoist(IRole role)
|
||||
{
|
||||
var newHoisted = !role.IsHoisted;
|
||||
await role.ModifyAsync(r => r.Hoist = newHoisted);
|
||||
@@ -317,20 +304,18 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.rolehoist_disabled(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task RoleColor([Leftover] IRole role)
|
||||
public async partial Task RoleColor([Leftover] IRole role)
|
||||
=> await SendConfirmAsync("Role Color", role.Color.RawValue.ToString("x6"));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(0)]
|
||||
public async Task RoleColor(Color color, [Leftover] IRole role)
|
||||
public async partial Task RoleColor(Color color, [Leftover] IRole role)
|
||||
{
|
||||
try
|
||||
{
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class SelfCommands : NadekoSubmodule<SelfService>
|
||||
public partial class SelfCommands : NadekoSubmodule<SelfService>
|
||||
{
|
||||
public enum SettableUserStatus
|
||||
{
|
||||
@@ -28,12 +28,11 @@ public partial class Administration
|
||||
_coord = coord;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task StartupCommandAdd([Leftover] string cmdText)
|
||||
public async partial Task StartupCommandAdd([Leftover] string cmdText)
|
||||
{
|
||||
if (cmdText.StartsWith(Prefix + "die", StringComparison.InvariantCulture))
|
||||
return;
|
||||
@@ -62,12 +61,11 @@ public partial class Administration
|
||||
.AddField(GetText(strs.command_text), cmdText));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task AutoCommandAdd(int interval, [Leftover] string cmdText)
|
||||
public async partial Task AutoCommandAdd(int interval, [Leftover] string cmdText)
|
||||
{
|
||||
if (cmdText.StartsWith(Prefix + "die", StringComparison.InvariantCulture))
|
||||
return;
|
||||
@@ -92,11 +90,10 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.autocmd_add(Format.Code(Format.Sanitize(cmdText)), cmd.Interval));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task StartupCommandsList(int page = 1)
|
||||
public async partial Task StartupCommandsList(int page = 1)
|
||||
{
|
||||
if (page-- < 1)
|
||||
return;
|
||||
@@ -121,11 +118,10 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task AutoCommandsList(int page = 1)
|
||||
public async partial Task AutoCommandsList(int page = 1)
|
||||
{
|
||||
if (page-- < 1)
|
||||
return;
|
||||
@@ -153,10 +149,9 @@ public partial class Administration
|
||||
private string GetIntervalText(int interval)
|
||||
=> $"[{GetText(strs.interval)}]: {interval}";
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Wait(int miliseconds)
|
||||
public async partial Task Wait(int miliseconds)
|
||||
{
|
||||
if (miliseconds <= 0)
|
||||
return;
|
||||
@@ -171,12 +166,11 @@ public partial class Administration
|
||||
await Task.Delay(miliseconds);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task AutoCommandRemove([Leftover] int index)
|
||||
public async partial Task AutoCommandRemove([Leftover] int index)
|
||||
{
|
||||
if (!_service.RemoveAutoCommand(--index, out _))
|
||||
{
|
||||
@@ -187,11 +181,10 @@ public partial class Administration
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task StartupCommandRemove([Leftover] int index)
|
||||
public async partial Task StartupCommandRemove([Leftover] int index)
|
||||
{
|
||||
if (!_service.RemoveStartupCommand(--index, out _))
|
||||
await ReplyErrorLocalizedAsync(strs.scrm_fail);
|
||||
@@ -199,22 +192,20 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.scrm);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[OwnerOnly]
|
||||
public async Task StartupCommandsClear()
|
||||
public async partial Task StartupCommandsClear()
|
||||
{
|
||||
_service.ClearStartupCommands();
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.startcmds_cleared);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ForwardMessages()
|
||||
public async partial Task ForwardMessages()
|
||||
{
|
||||
var enabled = _service.ForwardMessages();
|
||||
|
||||
@@ -224,10 +215,9 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.fwdm_stop);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ForwardToAll()
|
||||
public async partial Task ForwardToAll()
|
||||
{
|
||||
var enabled = _service.ForwardToAll();
|
||||
|
||||
@@ -237,9 +227,8 @@ public partial class Administration
|
||||
await ReplyPendingLocalizedAsync(strs.fwall_stop);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ShardStats(int page = 1)
|
||||
[Cmd]
|
||||
public async partial Task ShardStats(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -290,10 +279,9 @@ public partial class Administration
|
||||
};
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task RestartShard(int shardId)
|
||||
public async partial Task RestartShard(int shardId)
|
||||
{
|
||||
var success = _coord.RestartShard(shardId);
|
||||
if (success)
|
||||
@@ -302,17 +290,15 @@ public partial class Administration
|
||||
await ReplyErrorLocalizedAsync(strs.no_shard_id);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task Leave([Leftover] string guildStr)
|
||||
public partial Task Leave([Leftover] string guildStr)
|
||||
=> _service.LeaveGuild(guildStr);
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Die(bool graceful = false)
|
||||
public async partial Task Die(bool graceful = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -327,10 +313,9 @@ public partial class Administration
|
||||
_coord.Die(graceful);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Restart()
|
||||
public async partial Task Restart()
|
||||
{
|
||||
var success = _coord.RestartBot();
|
||||
if (!success)
|
||||
@@ -343,10 +328,9 @@ public partial class Administration
|
||||
catch { }
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SetName([Leftover] string newName)
|
||||
public async partial Task SetName([Leftover] string newName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(newName))
|
||||
return;
|
||||
@@ -363,12 +347,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_name(Format.Bold(newName)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.ManageNicknames)]
|
||||
[BotPerm(GuildPerm.ChangeNickname)]
|
||||
[Priority(0)]
|
||||
public async Task SetNick([Leftover] string newNick = null)
|
||||
public async partial Task SetNick([Leftover] string newNick = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(newNick))
|
||||
return;
|
||||
@@ -378,12 +361,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_nick(Format.Bold(newNick) ?? "-"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageNicknames)]
|
||||
[UserPerm(GuildPerm.ManageNicknames)]
|
||||
[Priority(1)]
|
||||
public async Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
|
||||
public async partial Task SetNick(IGuildUser gu, [Leftover] string newNick = null)
|
||||
{
|
||||
var sg = (SocketGuild)ctx.Guild;
|
||||
if (sg.OwnerId == gu.Id
|
||||
@@ -398,30 +380,27 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.user_nick(Format.Bold(gu.ToString()), Format.Bold(newNick) ?? "-"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SetStatus([Leftover] SettableUserStatus status)
|
||||
public async partial Task SetStatus([Leftover] SettableUserStatus status)
|
||||
{
|
||||
await _client.SetStatusAsync(SettableUserStatusToUserStatus(status));
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_status(Format.Bold(status.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SetAvatar([Leftover] string img = null)
|
||||
public async partial Task SetAvatar([Leftover] string img = null)
|
||||
{
|
||||
var success = await _service.SetAvatar(img);
|
||||
|
||||
if (success) await ReplyConfirmLocalizedAsync(strs.set_avatar);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SetGame(ActivityType type, [Leftover] string game = null)
|
||||
public async partial Task SetGame(ActivityType type, [Leftover] string game = null)
|
||||
{
|
||||
var rep = new ReplacementBuilder().WithDefault(Context).Build();
|
||||
|
||||
@@ -430,10 +409,9 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.set_game);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SetStream(string url, [Leftover] string name = null)
|
||||
public async partial Task SetStream(string url, [Leftover] string name = null)
|
||||
{
|
||||
name ??= "";
|
||||
|
||||
@@ -442,10 +420,9 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.set_stream);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Send(string where, [Leftover] SmartText text = null)
|
||||
public async partial Task Send(string where, [Leftover] SmartText text = null)
|
||||
{
|
||||
var ids = where.Split('|');
|
||||
if (ids.Length != 2)
|
||||
@@ -489,28 +466,25 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.message_sent);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ImagesReload()
|
||||
public async partial Task ImagesReload()
|
||||
{
|
||||
await _service.ReloadImagesAsync();
|
||||
await ReplyConfirmLocalizedAsync(strs.images_loading);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task StringsReload()
|
||||
public async partial Task StringsReload()
|
||||
{
|
||||
_strings.Reload();
|
||||
await ReplyConfirmLocalizedAsync(strs.bot_strings_reloaded);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task CoordReload()
|
||||
public async partial Task CoordReload()
|
||||
{
|
||||
await _coord.Reload();
|
||||
await ctx.OkAsync();
|
@@ -7,14 +7,13 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class SelfAssignedRolesCommands : NadekoSubmodule<SelfAssignedRolesService>
|
||||
public partial class SelfAssignedRolesCommands : NadekoSubmodule<SelfAssignedRolesService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[BotPerm(GuildPerm.ManageMessages)]
|
||||
public async Task AdSarm()
|
||||
public async partial Task AdSarm()
|
||||
{
|
||||
var newVal = _service.ToggleAdSarm(ctx.Guild.Id);
|
||||
|
||||
@@ -24,22 +23,20 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.adsarm_disable(Prefix));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(1)]
|
||||
public Task Asar([Leftover] IRole role)
|
||||
public partial Task Asar([Leftover] IRole role)
|
||||
=> Asar(0, role);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(0)]
|
||||
public async Task Asar(int group, [Leftover] IRole role)
|
||||
public async partial Task Asar(int group, [Leftover] IRole role)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position)
|
||||
@@ -54,13 +51,12 @@ public partial class Administration
|
||||
await ReplyErrorLocalizedAsync(strs.role_in_list(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[Priority(0)]
|
||||
public async Task Sargn(int group, [Leftover] string name = null)
|
||||
public async partial Task Sargn(int group, [Leftover] string name = null)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
|
||||
@@ -73,11 +69,10 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.group_name_removed(Format.Bold(group.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
public async Task Rsar([Leftover] IRole role)
|
||||
public async partial Task Rsar([Leftover] IRole role)
|
||||
{
|
||||
var guser = (IGuildUser)ctx.User;
|
||||
if (ctx.User.Id != guser.Guild.OwnerId && guser.GetRoles().Max(x => x.Position) <= role.Position)
|
||||
@@ -90,10 +85,9 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_rem(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Lsar(int page = 1)
|
||||
public async partial Task Lsar(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -147,12 +141,11 @@ public partial class Administration
|
||||
20);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task Togglexclsar()
|
||||
public async partial Task Togglexclsar()
|
||||
{
|
||||
var areExclusive = _service.ToggleEsar(ctx.Guild.Id);
|
||||
if (areExclusive)
|
||||
@@ -161,12 +154,11 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.self_assign_no_excl);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task RoleLevelReq(int level, [Leftover] IRole role)
|
||||
public async partial Task RoleLevelReq(int level, [Leftover] IRole role)
|
||||
{
|
||||
if (level < 0)
|
||||
return;
|
||||
@@ -183,23 +175,22 @@ public partial class Administration
|
||||
Format.Bold(level.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Iam([Leftover] IRole role)
|
||||
public async partial Task Iam([Leftover] IRole role)
|
||||
{
|
||||
var guildUser = (IGuildUser)ctx.User;
|
||||
|
||||
var (result, autoDelete, extra) = await _service.Assign(guildUser, role);
|
||||
|
||||
IUserMessage msg;
|
||||
if (result == SelfAssignedRolesService.AssignResult.Err_Not_Assignable)
|
||||
if (result == SelfAssignedRolesService.AssignResult.ErrNotAssignable)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not);
|
||||
else if (result == SelfAssignedRolesService.AssignResult.Err_Lvl_Req)
|
||||
else if (result == SelfAssignedRolesService.AssignResult.ErrLvlReq)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_level(Format.Bold(extra.ToString())));
|
||||
else if (result == SelfAssignedRolesService.AssignResult.Err_Already_Have)
|
||||
else if (result == SelfAssignedRolesService.AssignResult.ErrAlreadyHave)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_already(Format.Bold(role.Name)));
|
||||
else if (result == SelfAssignedRolesService.AssignResult.Err_Not_Perms)
|
||||
else if (result == SelfAssignedRolesService.AssignResult.ErrNotPerms)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms);
|
||||
else
|
||||
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_success(Format.Bold(role.Name)));
|
||||
@@ -211,21 +202,20 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Iamnot([Leftover] IRole role)
|
||||
public async partial Task Iamnot([Leftover] IRole role)
|
||||
{
|
||||
var guildUser = (IGuildUser)ctx.User;
|
||||
|
||||
var (result, autoDelete) = await _service.Remove(guildUser, role);
|
||||
|
||||
IUserMessage msg;
|
||||
if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Assignable)
|
||||
if (result == SelfAssignedRolesService.RemoveResult.ErrNotAssignable)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not);
|
||||
else if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Have)
|
||||
else if (result == SelfAssignedRolesService.RemoveResult.ErrNotHave)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_not_have(Format.Bold(role.Name)));
|
||||
else if (result == SelfAssignedRolesService.RemoveResult.Err_Not_Perms)
|
||||
else if (result == SelfAssignedRolesService.RemoveResult.ErrNotPerms)
|
||||
msg = await ReplyErrorLocalizedAsync(strs.self_assign_perms);
|
||||
else
|
||||
msg = await ReplyConfirmLocalizedAsync(strs.self_assign_remove(Format.Bold(role.Name)));
|
@@ -11,18 +11,18 @@ public class SelfAssignedRolesService : INService
|
||||
public enum AssignResult
|
||||
{
|
||||
Assigned, // successfully removed
|
||||
Err_Not_Assignable, // not assignable (error)
|
||||
Err_Already_Have, // you already have that role (error)
|
||||
Err_Not_Perms, // bot doesn't have perms (error)
|
||||
Err_Lvl_Req // you are not required level (error)
|
||||
ErrNotAssignable, // not assignable (error)
|
||||
ErrAlreadyHave, // you already have that role (error)
|
||||
ErrNotPerms, // bot doesn't have perms (error)
|
||||
ErrLvlReq // you are not required level (error)
|
||||
}
|
||||
|
||||
public enum RemoveResult
|
||||
{
|
||||
Removed, // successfully removed
|
||||
Err_Not_Assignable, // not assignable (error)
|
||||
Err_Not_Have, // you don't have a role you want to remove (error)
|
||||
Err_Not_Perms // bot doesn't have perms (error)
|
||||
ErrNotAssignable, // not assignable (error)
|
||||
ErrNotHave, // you don't have a role you want to remove (error)
|
||||
ErrNotPerms // bot doesn't have perms (error)
|
||||
}
|
||||
|
||||
private readonly DbService _db;
|
||||
@@ -64,10 +64,10 @@ public class SelfAssignedRolesService : INService
|
||||
|
||||
var theRoleYouWant = roles.FirstOrDefault(r => r.RoleId == role.Id);
|
||||
if (theRoleYouWant is null)
|
||||
return (AssignResult.Err_Not_Assignable, autoDelete, null);
|
||||
return (AssignResult.ErrNotAssignable, autoDelete, null);
|
||||
if (theRoleYouWant.LevelRequirement > userLevelData.Level)
|
||||
return (AssignResult.Err_Lvl_Req, autoDelete, theRoleYouWant.LevelRequirement);
|
||||
if (guildUser.RoleIds.Contains(role.Id)) return (AssignResult.Err_Already_Have, autoDelete, null);
|
||||
return (AssignResult.ErrLvlReq, autoDelete, theRoleYouWant.LevelRequirement);
|
||||
if (guildUser.RoleIds.Contains(role.Id)) return (AssignResult.ErrAlreadyHave, autoDelete, null);
|
||||
|
||||
var roleIds = roles.Where(x => x.Group == theRoleYouWant.Group).Select(x => x.RoleId).ToArray();
|
||||
if (exclusive)
|
||||
@@ -96,7 +96,7 @@ public class SelfAssignedRolesService : INService
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return (AssignResult.Err_Not_Perms, autoDelete, ex);
|
||||
return (AssignResult.ErrNotPerms, autoDelete, ex);
|
||||
}
|
||||
|
||||
return (AssignResult.Assigned, autoDelete, null);
|
||||
@@ -135,15 +135,15 @@ public class SelfAssignedRolesService : INService
|
||||
var (autoDelete, _, roles) = GetAdAndRoles(guildUser.Guild.Id);
|
||||
|
||||
if (roles.FirstOrDefault(r => r.RoleId == role.Id) is null)
|
||||
return (RemoveResult.Err_Not_Assignable, autoDelete);
|
||||
if (!guildUser.RoleIds.Contains(role.Id)) return (RemoveResult.Err_Not_Have, autoDelete);
|
||||
return (RemoveResult.ErrNotAssignable, autoDelete);
|
||||
if (!guildUser.RoleIds.Contains(role.Id)) return (RemoveResult.ErrNotHave, autoDelete);
|
||||
try
|
||||
{
|
||||
await guildUser.RemoveRoleAsync(role);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return (RemoveResult.Err_Not_Perms, autoDelete);
|
||||
return (RemoveResult.ErrNotPerms, autoDelete);
|
||||
}
|
||||
|
||||
return (RemoveResult.Removed, autoDelete);
|
@@ -118,11 +118,9 @@ public sealed class ImageOnlyChannelService : IEarlyBehavior
|
||||
if (user.GetRoles().Max(x => x.Position) >= botUser.GetRoles().Max(x => x.Position))
|
||||
return false;
|
||||
|
||||
// can't modify channel perms if not admin apparently
|
||||
if (!botUser.GuildPermissions.ManageGuild)
|
||||
if (!botUser.GetPermissions(tch).ManageChannel)
|
||||
{
|
||||
ToggleImageOnlyChannel(tch.GuildId, tch.Id, true);
|
||||
;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -142,7 +140,7 @@ public sealed class ImageOnlyChannelService : IEarlyBehavior
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex, "Error deleting message {MessageId} in image-only channel {ChannelId}.", msg.Id, tch.Id);
|
||||
Log.Error(ex, "Error deleting message {MessageId} in image-only channel {ChannelId}", msg.Id, tch.Id);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -6,12 +6,11 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class TimeZoneCommands : NadekoSubmodule<GuildTimezoneService>
|
||||
public partial class TimeZoneCommands : NadekoSubmodule<GuildTimezoneService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Timezones(int page = 1)
|
||||
public async partial Task Timezones(int page = 1)
|
||||
{
|
||||
page--;
|
||||
|
||||
@@ -47,17 +46,15 @@ public partial class Administration
|
||||
timezonesPerPage);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Timezone()
|
||||
public async partial Task Timezone()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.timezone_guild(_service.GetTimeZoneOrUtc(ctx.Guild.Id)));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task Timezone([Leftover] string id)
|
||||
public async partial Task Timezone([Leftover] string id)
|
||||
{
|
||||
TimeZoneInfo tz;
|
||||
try { tz = TimeZoneInfo.FindSystemTimeZoneById(id); }
|
@@ -11,7 +11,7 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class UserPunishCommands : NadekoSubmodule<UserPunishService>
|
||||
public partial class UserPunishCommands : NadekoSubmodule<UserPunishService>
|
||||
{
|
||||
public enum AddRole
|
||||
{
|
||||
@@ -48,18 +48,16 @@ public partial class Administration
|
||||
return true;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public Task Warn(IGuildUser user, [Leftover] string reason = null)
|
||||
public partial Task Warn(IGuildUser user, [Leftover] string reason = null)
|
||||
=> Warn(1, user, reason);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public async Task Warn(int weight, IGuildUser user, [Leftover] string reason = null)
|
||||
public async partial Task Warn(int weight, IGuildUser user, [Leftover] string reason = null)
|
||||
{
|
||||
if (weight <= 0)
|
||||
return;
|
||||
@@ -109,13 +107,12 @@ public partial class Administration
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[NadekoOptions(typeof(WarnExpireOptions))]
|
||||
[Priority(1)]
|
||||
public async Task WarnExpire()
|
||||
public async partial Task WarnExpire()
|
||||
{
|
||||
var expireDays = await _service.GetWarnExpire(ctx.Guild.Id);
|
||||
|
||||
@@ -125,13 +122,12 @@ public partial class Administration
|
||||
await ReplyErrorLocalizedAsync(strs.warns_expire_in(expireDays));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[NadekoOptions(typeof(WarnExpireOptions))]
|
||||
[Priority(2)]
|
||||
public async Task WarnExpire(int days, params string[] args)
|
||||
public async partial Task WarnExpire(int days, params string[] args)
|
||||
{
|
||||
if (days is < 0 or > 366)
|
||||
return;
|
||||
@@ -153,23 +149,21 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_expire_set_clear(Format.Bold(days.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[Priority(2)]
|
||||
public Task Warnlog(int page, [Leftover] IGuildUser user = null)
|
||||
public partial Task Warnlog(int page, [Leftover] IGuildUser user = null)
|
||||
{
|
||||
user ??= (IGuildUser)ctx.User;
|
||||
|
||||
return Warnlog(page, user.Id);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(3)]
|
||||
public Task Warnlog(IGuildUser user = null)
|
||||
public partial Task Warnlog(IGuildUser user = null)
|
||||
{
|
||||
user ??= (IGuildUser)ctx.User;
|
||||
|
||||
@@ -178,20 +172,18 @@ public partial class Administration
|
||||
: Task.CompletedTask;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[Priority(0)]
|
||||
public Task Warnlog(int page, ulong userId)
|
||||
public partial Task Warnlog(int page, ulong userId)
|
||||
=> InternalWarnlog(userId, page - 1);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[Priority(1)]
|
||||
public Task Warnlog(ulong userId)
|
||||
public partial Task Warnlog(ulong userId)
|
||||
=> InternalWarnlog(userId, 0);
|
||||
|
||||
private async Task InternalWarnlog(ulong userId, int inputPage)
|
||||
@@ -244,11 +236,10 @@ public partial class Administration
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public async Task WarnlogAll(int page = 1)
|
||||
public async partial Task WarnlogAll(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -279,18 +270,16 @@ public partial class Administration
|
||||
15);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public Task Warnclear(IGuildUser user, int index = 0)
|
||||
public partial Task Warnclear(IGuildUser user, int index = 0)
|
||||
=> Warnclear(user.Id, index);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public async Task Warnclear(ulong userId, int index = 0)
|
||||
public async partial Task Warnclear(ulong userId, int index = 0)
|
||||
{
|
||||
if (index < 0)
|
||||
return;
|
||||
@@ -309,12 +298,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[Priority(1)]
|
||||
public async Task WarnPunish(
|
||||
public async partial Task WarnPunish(
|
||||
int number,
|
||||
AddRole _,
|
||||
IRole role,
|
||||
@@ -343,11 +331,10 @@ public partial class Administration
|
||||
Format.Bold(time.Input)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public async Task WarnPunish(int number, PunishmentAction punish, StoopidTime time = null)
|
||||
public async partial Task WarnPunish(int number, PunishmentAction punish, StoopidTime time = null)
|
||||
{
|
||||
// this should never happen. Addrole has its own method with higher priority
|
||||
if (punish == PunishmentAction.AddRole)
|
||||
@@ -367,21 +354,19 @@ public partial class Administration
|
||||
Format.Bold(time.Input)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
public async Task WarnPunish(int number)
|
||||
public async partial Task WarnPunish(int number)
|
||||
{
|
||||
if (!_service.WarnPunishRemove(ctx.Guild.Id, number)) return;
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.warn_punish_rem(Format.Bold(number.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task WarnPunishList()
|
||||
public async partial Task WarnPunishList()
|
||||
{
|
||||
var ps = _service.WarnPunishList(ctx.Guild.Id);
|
||||
|
||||
@@ -395,13 +380,12 @@ public partial class Administration
|
||||
await SendConfirmAsync(GetText(strs.warn_punish_list), list);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[Priority(1)]
|
||||
public async Task Ban(StoopidTime time, IUser user, [Leftover] string msg = null)
|
||||
public async partial Task Ban(StoopidTime time, IUser user, [Leftover] string msg = null)
|
||||
{
|
||||
if (time.Time > TimeSpan.FromDays(49))
|
||||
return;
|
||||
@@ -440,13 +424,12 @@ public partial class Administration
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[Priority(0)]
|
||||
public async Task Ban(ulong userId, [Leftover] string msg = null)
|
||||
public async partial Task Ban(ulong userId, [Leftover] string msg = null)
|
||||
{
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId);
|
||||
if (user is null)
|
||||
@@ -464,13 +447,12 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[Priority(2)]
|
||||
public async Task Ban(IGuildUser user, [Leftover] string msg = null)
|
||||
public async partial Task Ban(IGuildUser user, [Leftover] string msg = null)
|
||||
{
|
||||
if (!await CheckRoleHierarchy(user))
|
||||
return;
|
||||
@@ -501,12 +483,11 @@ public partial class Administration
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task BanMessage([Leftover] string message = null)
|
||||
public async partial Task BanMessage([Leftover] string message = null)
|
||||
{
|
||||
if (message is null)
|
||||
{
|
||||
@@ -525,33 +506,30 @@ public partial class Administration
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task BanMsgReset()
|
||||
public async partial Task BanMsgReset()
|
||||
{
|
||||
_service.SetBanTemplate(ctx.Guild.Id, null);
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[Priority(0)]
|
||||
public Task BanMessageTest([Leftover] string reason = null)
|
||||
public partial Task BanMessageTest([Leftover] string reason = null)
|
||||
=> InternalBanMessageTest(reason, null);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[Priority(1)]
|
||||
public Task BanMessageTest(StoopidTime duration, [Leftover] string reason = null)
|
||||
public partial Task BanMessageTest(StoopidTime duration, [Leftover] string reason = null)
|
||||
=> InternalBanMessageTest(reason, duration.Time);
|
||||
|
||||
private async Task InternalBanMessageTest(string reason, TimeSpan? duration)
|
||||
@@ -579,12 +557,11 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task Unban([Leftover] string user)
|
||||
public async partial Task Unban([Leftover] string user)
|
||||
{
|
||||
var bans = await ctx.Guild.GetBansAsync();
|
||||
|
||||
@@ -599,12 +576,11 @@ public partial class Administration
|
||||
await UnbanInternal(bun.User);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task Unban(ulong userId)
|
||||
public async partial Task Unban(ulong userId)
|
||||
{
|
||||
var bans = await ctx.Guild.GetBansAsync();
|
||||
|
||||
@@ -626,20 +602,18 @@ public partial class Administration
|
||||
await ReplyConfirmLocalizedAsync(strs.unbanned_user(Format.Bold(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.KickMembers | GuildPerm.ManageMessages)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public Task Softban(IGuildUser user, [Leftover] string msg = null)
|
||||
public partial Task Softban(IGuildUser user, [Leftover] string msg = null)
|
||||
=> SoftbanInternal(user, msg);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.KickMembers | GuildPerm.ManageMessages)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
public async Task Softban(ulong userId, [Leftover] string msg = null)
|
||||
public async partial Task Softban(ulong userId, [Leftover] string msg = null)
|
||||
{
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId);
|
||||
if (user is null)
|
||||
@@ -679,22 +653,20 @@ public partial class Administration
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.KickMembers)]
|
||||
[BotPerm(GuildPerm.KickMembers)]
|
||||
[Priority(1)]
|
||||
public Task Kick(IGuildUser user, [Leftover] string msg = null)
|
||||
public partial Task Kick(IGuildUser user, [Leftover] string msg = null)
|
||||
=> KickInternal(user, msg);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.KickMembers)]
|
||||
[BotPerm(GuildPerm.KickMembers)]
|
||||
[Priority(0)]
|
||||
public async Task Kick(ulong userId, [Leftover] string msg = null)
|
||||
public async partial Task Kick(ulong userId, [Leftover] string msg = null)
|
||||
{
|
||||
var user = await ((DiscordSocketClient)Context.Client).Rest.GetGuildUserAsync(ctx.Guild.Id, userId);
|
||||
if (user is null)
|
||||
@@ -703,7 +675,7 @@ public partial class Administration
|
||||
await KickInternal(user, msg);
|
||||
}
|
||||
|
||||
public async Task KickInternal(IGuildUser user, string msg = null)
|
||||
private async Task KickInternal(IGuildUser user, string msg = null)
|
||||
{
|
||||
if (!await CheckRoleHierarchy(user))
|
||||
return;
|
||||
@@ -732,13 +704,12 @@ public partial class Administration
|
||||
await ctx.Channel.EmbedAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[Ratelimit(30)]
|
||||
public async Task MassBan(params string[] userStrings)
|
||||
public async partial Task MassBan(params string[] userStrings)
|
||||
{
|
||||
if (userStrings.Length == 0)
|
||||
return;
|
||||
@@ -806,13 +777,12 @@ public partial class Administration
|
||||
.Build());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.BanMembers)]
|
||||
[BotPerm(GuildPerm.BanMembers)]
|
||||
[OwnerOnly]
|
||||
public async Task MassKill([Leftover] string people)
|
||||
public async partial Task MassKill([Leftover] string people)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(people))
|
||||
return;
|
@@ -6,14 +6,13 @@ namespace NadekoBot.Modules.Administration;
|
||||
public partial class Administration
|
||||
{
|
||||
[Group]
|
||||
public class VcRoleCommands : NadekoSubmodule<VcRoleService>
|
||||
public partial class VcRoleCommands : NadekoSubmodule<VcRoleService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task VcRoleRm(ulong vcId)
|
||||
public async partial Task VcRoleRm(ulong vcId)
|
||||
{
|
||||
if (_service.RemoveVcRole(ctx.Guild.Id, vcId))
|
||||
await ReplyConfirmLocalizedAsync(strs.vcrole_removed(Format.Bold(vcId.ToString())));
|
||||
@@ -21,12 +20,11 @@ public partial class Administration
|
||||
await ReplyErrorLocalizedAsync(strs.vcrole_not_found);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task VcRole([Leftover] IRole role = null)
|
||||
public async partial Task VcRole([Leftover] IRole role = null)
|
||||
{
|
||||
var user = (IGuildUser)ctx.User;
|
||||
|
||||
@@ -50,10 +48,9 @@ public partial class Administration
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task VcRoleList()
|
||||
public async partial Task VcRoleList()
|
||||
{
|
||||
var guild = (SocketGuild)ctx.Guild;
|
||||
string text;
|
@@ -3,7 +3,7 @@ using NadekoBot.Modules.CustomReactions.Services;
|
||||
|
||||
namespace NadekoBot.Modules.CustomReactions;
|
||||
|
||||
public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
public partial class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
{
|
||||
public enum All
|
||||
{
|
||||
@@ -23,9 +23,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
=> (ctx.Guild is null && _creds.IsOwner(ctx.User))
|
||||
|| (ctx.Guild != null && ((IGuildUser)ctx.User).GuildPermissions.Administrator);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task AddCustReact(string key, [Leftover] string message)
|
||||
[Cmd]
|
||||
public async partial Task AddCustReact(string key, [Leftover] string message)
|
||||
{
|
||||
var channel = ctx.Channel as ITextChannel;
|
||||
if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key))
|
||||
@@ -48,9 +47,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
message.Length > 1024 ? GetText(strs.redacted_too_long) : message));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task EditCustReact(kwum id, [Leftover] string message)
|
||||
[Cmd]
|
||||
public async partial Task EditCustReact(kwum id, [Leftover] string message)
|
||||
{
|
||||
var channel = ctx.Channel as ITextChannel;
|
||||
if (string.IsNullOrWhiteSpace(message) || id < 0)
|
||||
@@ -76,10 +74,9 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
await ReplyErrorLocalizedAsync(strs.edit_fail);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task ListCustReact(int page = 1)
|
||||
public async partial Task ListCustReact(int page = 1)
|
||||
{
|
||||
if (--page < 0 || page > 999)
|
||||
return;
|
||||
@@ -113,9 +110,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
20);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ShowCustReact(kwum id)
|
||||
[Cmd]
|
||||
public async partial Task ShowCustReact(kwum id)
|
||||
{
|
||||
var found = _service.GetCustomReaction(ctx.Guild?.Id, id);
|
||||
|
||||
@@ -133,9 +129,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
found.Response.TrimTo(1000).Replace("](", "]\\(")));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task DelCustReact(kwum id)
|
||||
[Cmd]
|
||||
public async partial Task DelCustReact(kwum id)
|
||||
{
|
||||
if (!AdminInGuildOrOwnerInDm())
|
||||
{
|
||||
@@ -156,9 +151,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
await ReplyErrorLocalizedAsync(strs.no_found_id);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task CrReact(kwum id, params string[] emojiStrs)
|
||||
[Cmd]
|
||||
public async partial Task CrReact(kwum id, params string[] emojiStrs)
|
||||
{
|
||||
if (!AdminInGuildOrOwnerInDm())
|
||||
{
|
||||
@@ -211,30 +205,25 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
string.Join(", ", succ.Select(x => x.ToString()))));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task CrCa(kwum id)
|
||||
[Cmd]
|
||||
public partial Task CrCa(kwum id)
|
||||
=> InternalCrEdit(id, CustomReactionsService.CrField.ContainsAnywhere);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task CrDm(kwum id)
|
||||
[Cmd]
|
||||
public partial Task CrDm(kwum id)
|
||||
=> InternalCrEdit(id, CustomReactionsService.CrField.DmResponse);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task CrAd(kwum id)
|
||||
[Cmd]
|
||||
public partial Task CrAd(kwum id)
|
||||
=> InternalCrEdit(id, CustomReactionsService.CrField.AutoDelete);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task CrAt(kwum id)
|
||||
[Cmd]
|
||||
public partial Task CrAt(kwum id)
|
||||
=> InternalCrEdit(id, CustomReactionsService.CrField.AllowTarget);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task CrsReload()
|
||||
public async partial Task CrsReload()
|
||||
{
|
||||
await _service.TriggerReloadCustomReactions();
|
||||
|
||||
@@ -265,11 +254,10 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
Format.Code(id.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task CrClear()
|
||||
public async partial Task CrClear()
|
||||
{
|
||||
if (await PromptUserConfirmAsync(_eb.Create()
|
||||
.WithTitle("Custom reaction clear")
|
||||
@@ -280,9 +268,8 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task CrsExport()
|
||||
[Cmd]
|
||||
public async partial Task CrsExport()
|
||||
{
|
||||
if (!AdminInGuildOrOwnerInDm())
|
||||
{
|
||||
@@ -297,12 +284,11 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
||||
await ctx.Channel.SendFileAsync(stream, "crs-export.yml");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
#if GLOBAL_NADEKO
|
||||
[OwnerOnly]
|
||||
#endif
|
||||
public async Task CrsImport([Leftover] string input = null)
|
||||
public async partial Task CrsImport([Leftover] string input = null)
|
||||
{
|
||||
if (!AdminInGuildOrOwnerInDm())
|
||||
{
|
||||
|
@@ -11,7 +11,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class AnimalRacingCommands : GamblingSubmodule<AnimalRaceService>
|
||||
public partial class AnimalRacingCommands : GamblingSubmodule<AnimalRaceService>
|
||||
{
|
||||
private readonly ICurrencyService _cs;
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -31,11 +31,10 @@ public partial class Gambling
|
||||
_gamesConf = gamesConf;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoOptionsAttribute(typeof(RaceOptions))]
|
||||
public Task Race(params string[] args)
|
||||
public partial Task Race(params string[] args)
|
||||
{
|
||||
var (options, success) = OptionsParser.ParseFrom(new RaceOptions(), args);
|
||||
|
||||
@@ -124,10 +123,9 @@ public partial class Gambling
|
||||
return ReplyErrorLocalizedAsync(strs.animal_race_failed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task JoinRace(ShmartNumber amount = default)
|
||||
public async partial Task JoinRace(ShmartNumber amount = default)
|
||||
{
|
||||
if (!await CheckBetOptional(amount))
|
||||
return;
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public partial class Gambling
|
||||
{
|
||||
public class BlackJackCommands : GamblingSubmodule<BlackJackService>
|
||||
public partial class BlackJackCommands : GamblingSubmodule<BlackJackService>
|
||||
{
|
||||
public enum BjAction
|
||||
{
|
||||
@@ -27,10 +27,9 @@ public partial class Gambling
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task BlackJack(ShmartNumber amount)
|
||||
public async partial Task BlackJack(ShmartNumber amount)
|
||||
{
|
||||
if (!await CheckBetMandatory(amount))
|
||||
return;
|
||||
@@ -152,25 +151,22 @@ public partial class Gambling
|
||||
return $"{playerName} | Bet: {x.Bet}\n";
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Hit()
|
||||
public partial Task Hit()
|
||||
=> InternalBlackJack(BjAction.Hit);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Stand()
|
||||
public partial Task Stand()
|
||||
=> InternalBlackJack(BjAction.Stand);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Double()
|
||||
public partial Task Double()
|
||||
=> InternalBlackJack(BjAction.Double);
|
||||
|
||||
public async Task InternalBlackJack(BjAction a)
|
||||
private async Task InternalBlackJack(BjAction a)
|
||||
{
|
||||
if (!_service.Games.TryGetValue(ctx.Channel.Id, out var bj))
|
||||
return;
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class Connect4Commands : GamblingSubmodule<GamblingService>
|
||||
public partial class Connect4Commands : GamblingSubmodule<GamblingService>
|
||||
{
|
||||
private static readonly string[] numbers =
|
||||
{
|
||||
@@ -41,11 +41,10 @@ public partial class Gambling
|
||||
_cs = cs;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoOptionsAttribute(typeof(Connect4Game.Options))]
|
||||
public async Task Connect4(params string[] args)
|
||||
public async partial Task Connect4(params string[] args)
|
||||
{
|
||||
var (options, _) = OptionsParser.ParseFrom(new Connect4Game.Options(), args);
|
||||
if (!await CheckBetOptional(options.Bet))
|
||||
|
@@ -9,19 +9,18 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class CurrencyEventsCommands : GamblingSubmodule<CurrencyEventsService>
|
||||
public partial class CurrencyEventsCommands : GamblingSubmodule<CurrencyEventsService>
|
||||
{
|
||||
public CurrencyEventsCommands(GamblingConfigService gamblingConf)
|
||||
: base(gamblingConf)
|
||||
{
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoOptionsAttribute(typeof(EventOptions))]
|
||||
[OwnerOnly]
|
||||
public async Task EventStart(CurrencyEvent.Type ev, params string[] options)
|
||||
public async partial Task EventStart(CurrencyEvent.Type ev, params string[] options)
|
||||
{
|
||||
var (opts, _) = OptionsParser.ParseFrom(new EventOptions(), options);
|
||||
if (!await _service.TryCreateEventAsync(ctx.Guild.Id, ctx.Channel.Id, ev, opts, GetEmbed))
|
||||
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public partial class Gambling
|
||||
{
|
||||
public class CurrencyRaffleCommands : GamblingSubmodule<CurrencyRaffleService>
|
||||
public partial class CurrencyRaffleCommands : GamblingSubmodule<CurrencyRaffleService>
|
||||
{
|
||||
public enum Mixed { Mixed }
|
||||
|
||||
@@ -15,18 +15,16 @@ public partial class Gambling
|
||||
{
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public Task RaffleCur(Mixed _, ShmartNumber amount)
|
||||
public partial Task RaffleCur(Mixed _, ShmartNumber amount)
|
||||
=> RaffleCur(amount, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task RaffleCur(ShmartNumber amount, bool mixed = false)
|
||||
public async partial Task RaffleCur(ShmartNumber amount, bool mixed = false)
|
||||
{
|
||||
if (!await CheckBetMandatory(amount))
|
||||
return;
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class DiceRollCommands : NadekoSubmodule
|
||||
public partial class DiceRollCommands : NadekoSubmodule
|
||||
{
|
||||
private static readonly Regex dndRegex = new(@"^(?<n1>\d+)d(?<n2>\d+)(?:\+(?<add>\d+))?(?:\-(?<sub>\d+))?$",
|
||||
RegexOptions.Compiled);
|
||||
@@ -22,9 +22,8 @@ public partial class Gambling
|
||||
public DiceRollCommands(IDataCache data)
|
||||
=> _images = data.LocalImages;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Roll()
|
||||
[Cmd]
|
||||
public async partial Task Roll()
|
||||
{
|
||||
var rng = new NadekoRandom();
|
||||
var gen = rng.Next(1, 101);
|
||||
@@ -41,29 +40,25 @@ public partial class Gambling
|
||||
Format.Bold(ctx.User.ToString()) + " " + GetText(strs.dice_rolled(Format.Code(gen.ToString()))));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Roll(int num)
|
||||
public async partial Task Roll(int num)
|
||||
=> await InternalRoll(num, true);
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Rolluo(int num = 1)
|
||||
public async partial Task Rolluo(int num = 1)
|
||||
=> await InternalRoll(num, false);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Roll(string arg)
|
||||
public async partial Task Roll(string arg)
|
||||
=> await InternallDndRoll(arg, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Rolluo(string arg)
|
||||
public async partial Task Rolluo(string arg)
|
||||
=> await InternallDndRoll(arg, false);
|
||||
|
||||
private async Task InternalRoll(int num, bool ordered)
|
||||
@@ -174,9 +169,8 @@ public partial class Gambling
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task NRoll([Leftover] string range)
|
||||
[Cmd]
|
||||
public async partial Task NRoll([Leftover] string range)
|
||||
{
|
||||
int rolled;
|
||||
if (range.Contains("-"))
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class DrawCommands : NadekoSubmodule
|
||||
public partial class DrawCommands : NadekoSubmodule
|
||||
{
|
||||
private static readonly ConcurrentDictionary<IGuild, Deck> _allDecks = new();
|
||||
private readonly IImageCache _images;
|
||||
@@ -59,10 +59,9 @@ public partial class Gambling
|
||||
return (img.ToStream(), toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Draw(int num = 1)
|
||||
public async partial Task Draw(int num = 1)
|
||||
{
|
||||
if (num < 1)
|
||||
num = 1;
|
||||
@@ -76,9 +75,8 @@ public partial class Gambling
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task DrawNew(int num = 1)
|
||||
[Cmd]
|
||||
public async partial Task DrawNew(int num = 1)
|
||||
{
|
||||
if (num < 1)
|
||||
num = 1;
|
||||
@@ -92,10 +90,9 @@ public partial class Gambling
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task DeckShuffle()
|
||||
public async partial Task DeckShuffle()
|
||||
{
|
||||
//var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
|
@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class FlipCoinCommands : GamblingSubmodule<GamblingService>
|
||||
public partial class FlipCoinCommands : GamblingSubmodule<GamblingService>
|
||||
{
|
||||
public enum BetFlipGuess
|
||||
{
|
||||
@@ -33,9 +33,8 @@ public partial class Gambling
|
||||
_cs = cs;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Flip(int count = 1)
|
||||
[Cmd]
|
||||
public async partial Task Flip(int count = 1)
|
||||
{
|
||||
if (count is > 10 or < 1)
|
||||
{
|
||||
@@ -75,9 +74,8 @@ public partial class Gambling
|
||||
await ctx.Channel.SendFileAsync(stream, $"{count} coins.{format.FileExtensions.First()}", msg);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Betflip(ShmartNumber amount, BetFlipGuess guess)
|
||||
[Cmd]
|
||||
public async partial Task Betflip(ShmartNumber amount, BetFlipGuess guess)
|
||||
{
|
||||
if (!await CheckBetMandatory(amount) || amount == 1)
|
||||
return;
|
||||
|
@@ -74,9 +74,8 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
return n(uow.DiscordUser.GetUserCurrency(id));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Economy()
|
||||
[Cmd]
|
||||
public async partial Task Economy()
|
||||
{
|
||||
var ec = _service.GetEconomy();
|
||||
decimal onePercent = 0;
|
||||
@@ -99,9 +98,8 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Timely()
|
||||
[Cmd]
|
||||
public async partial Task Timely()
|
||||
{
|
||||
var val = _config.Timely.Amount;
|
||||
var period = _config.Timely.Cooldown;
|
||||
@@ -123,19 +121,17 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ReplyConfirmLocalizedAsync(strs.timely(n(val), period));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task TimelyReset()
|
||||
public async partial Task TimelyReset()
|
||||
{
|
||||
_cache.RemoveAllTimelyClaims();
|
||||
await ReplyConfirmLocalizedAsync(strs.timely_reset);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task TimelySet(int amount, int period = 24)
|
||||
public async partial Task TimelySet(int amount, int period = 24)
|
||||
{
|
||||
if (amount < 0 || period < 0)
|
||||
return;
|
||||
@@ -152,10 +148,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ReplyConfirmLocalizedAsync(strs.timely_set(Format.Bold(n(amount)), Format.Bold(period.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Raffle([Leftover] IRole role = null)
|
||||
public async partial Task Raffle([Leftover] IRole role = null)
|
||||
{
|
||||
role ??= ctx.Guild.EveryoneRole;
|
||||
|
||||
@@ -168,10 +163,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
footer: $"ID: {usr.Id}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RaffleAny([Leftover] IRole role = null)
|
||||
public async partial Task RaffleAny([Leftover] IRole role = null)
|
||||
{
|
||||
role ??= ctx.Guild.EveryoneRole;
|
||||
|
||||
@@ -184,24 +178,21 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
footer: $"ID: {usr.Id}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(2)]
|
||||
public Task CurrencyTransactions(int page = 1)
|
||||
public partial Task CurrencyTransactions(int page = 1)
|
||||
=> InternalCurrencyTransactions(ctx.User.Id, page);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
[Priority(0)]
|
||||
public Task CurrencyTransactions([Leftover] IUser usr)
|
||||
public partial Task CurrencyTransactions([Leftover] IUser usr)
|
||||
=> InternalCurrencyTransactions(usr.Id, 1);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
[Priority(1)]
|
||||
public Task CurrencyTransactions(IUser usr, int page)
|
||||
public partial Task CurrencyTransactions(IUser usr, int page)
|
||||
=> InternalCurrencyTransactions(usr.Id, page);
|
||||
|
||||
private async Task InternalCurrencyTransactions(ulong userId, int page)
|
||||
@@ -233,26 +224,23 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Cash(ulong userId)
|
||||
public async partial Task Cash(ulong userId)
|
||||
=> await ReplyConfirmLocalizedAsync(strs.has(Format.Code(userId.ToString()), $"{GetCurrency(userId)}"));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Cash([Leftover] IUser user = null)
|
||||
public async partial Task Cash([Leftover] IUser user = null)
|
||||
{
|
||||
user ??= ctx.User;
|
||||
await ConfirmLocalizedAsync(strs.has(Format.Bold(user.ToString()), $"{GetCurrency(user.Id)}"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg = null)
|
||||
public async partial Task Give(ShmartNumber amount, IGuildUser receiver, [Leftover] string msg = null)
|
||||
{
|
||||
if (amount <= 0 || ctx.User.Id == receiver.Id || receiver.IsBot)
|
||||
return;
|
||||
@@ -268,34 +256,30 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ReplyConfirmLocalizedAsync(strs.gifted(n(amount), Format.Bold(receiver.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver)
|
||||
public partial Task Give(ShmartNumber amount, [Leftover] IGuildUser receiver)
|
||||
=> Give(amount, receiver, null);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
[Priority(0)]
|
||||
public Task Award(long amount, IGuildUser usr, [Leftover] string msg)
|
||||
public partial Task Award(long amount, IGuildUser usr, [Leftover] string msg)
|
||||
=> Award(amount, usr.Id, msg);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
[Priority(1)]
|
||||
public Task Award(long amount, [Leftover] IGuildUser usr)
|
||||
public partial Task Award(long amount, [Leftover] IGuildUser usr)
|
||||
=> Award(amount, usr.Id);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
[Priority(2)]
|
||||
public async Task Award(long amount, ulong usrId, [Leftover] string msg = null)
|
||||
public async partial Task Award(long amount, ulong usrId, [Leftover] string msg = null)
|
||||
{
|
||||
if (amount <= 0)
|
||||
return;
|
||||
@@ -315,12 +299,11 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ReplyConfirmLocalizedAsync(strs.awarded(n(amount), $"<@{usrId}>"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
[Priority(3)]
|
||||
public async Task Award(long amount, [Leftover] IRole role)
|
||||
public async partial Task Award(long amount, [Leftover] IRole role)
|
||||
{
|
||||
var users = (await ctx.Guild.GetUsersAsync()).Where(u => u.GetRoles().Contains(role)).ToList();
|
||||
|
||||
@@ -334,12 +317,11 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
[Priority(0)]
|
||||
public async Task Take(long amount, [Leftover] IRole role)
|
||||
public async partial Task Take(long amount, [Leftover] IRole role)
|
||||
{
|
||||
var users = (await role.GetMembersAsync()).ToList();
|
||||
|
||||
@@ -353,12 +335,11 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
[Priority(1)]
|
||||
public async Task Take(long amount, [Leftover] IGuildUser user)
|
||||
public async partial Task Take(long amount, [Leftover] IGuildUser user)
|
||||
{
|
||||
if (amount <= 0)
|
||||
return;
|
||||
@@ -373,10 +354,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
}
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Take(long amount, [Leftover] ulong usrId)
|
||||
public async partial Task Take(long amount, [Leftover] ulong usrId)
|
||||
{
|
||||
if (amount <= 0)
|
||||
return;
|
||||
@@ -390,10 +370,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await ReplyErrorLocalizedAsync(strs.take_fail(n(amount), Format.Code(usrId.ToString()), CurrencySign));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RollDuel(IUser u)
|
||||
public async partial Task RollDuel(IUser u)
|
||||
{
|
||||
if (ctx.User.Id == u.Id)
|
||||
return;
|
||||
@@ -403,10 +382,9 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
if (_service.Duels.TryRemove((ctx.User.Id, u.Id), out var game)) await game.StartGame();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RollDuel(ShmartNumber amount, IUser u)
|
||||
public async partial Task RollDuel(ShmartNumber amount, IUser u)
|
||||
{
|
||||
if (ctx.User.Id == u.Id)
|
||||
return;
|
||||
@@ -517,23 +495,20 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
await SendConfirmAsync(str);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task BetRoll(ShmartNumber amount)
|
||||
[Cmd]
|
||||
public partial Task BetRoll(ShmartNumber amount)
|
||||
=> InternallBetroll(amount);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[NadekoOptions(typeof(LbOpts))]
|
||||
[Priority(0)]
|
||||
public Task Leaderboard(params string[] args)
|
||||
public partial Task Leaderboard(params string[] args)
|
||||
=> Leaderboard(1, args);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[NadekoOptions(typeof(LbOpts))]
|
||||
[Priority(1)]
|
||||
public async Task Leaderboard(int page = 1, params string[] args)
|
||||
public async partial Task Leaderboard(int page = 1, params string[] args)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -603,9 +578,8 @@ public partial class Gambling : GamblingModule<GamblingService>
|
||||
opts.Clean);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Rps(RpsPick pick, ShmartNumber amount = default)
|
||||
[Cmd]
|
||||
public async partial Task Rps(RpsPick pick, ShmartNumber amount = default)
|
||||
{
|
||||
long oldAmount = amount;
|
||||
if (!await CheckBetOptional(amount) || amount == 1)
|
||||
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class PlantPickCommands : GamblingSubmodule<PlantPickService>
|
||||
public partial class PlantPickCommands : GamblingSubmodule<PlantPickService>
|
||||
{
|
||||
private readonly ILogCommandService logService;
|
||||
|
||||
@@ -16,10 +16,9 @@ public partial class Gambling
|
||||
: base(gss)
|
||||
=> this.logService = logService;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Pick(string pass = null)
|
||||
public async partial Task Pick(string pass = null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(pass) && !pass.IsAlphaNumeric()) return;
|
||||
|
||||
@@ -40,10 +39,9 @@ public partial class Gambling
|
||||
catch { }
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Plant(ShmartNumber amount, string pass = null)
|
||||
public async partial Task Plant(ShmartNumber amount, string pass = null)
|
||||
{
|
||||
if (amount < 1)
|
||||
return;
|
||||
@@ -65,14 +63,13 @@ public partial class Gambling
|
||||
if (!success) await ReplyErrorLocalizedAsync(strs.not_enough(CurrencySign));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
#if GLOBAL_NADEKO
|
||||
[OwnerOnly]
|
||||
#endif
|
||||
public async Task GenCurrency()
|
||||
public async partial Task GenCurrency()
|
||||
{
|
||||
var enabled = _service.ToggleCurrencyGeneration(ctx.Guild.Id, ctx.Channel.Id);
|
||||
if (enabled)
|
||||
@@ -81,12 +78,11 @@ public partial class Gambling
|
||||
await ReplyConfirmLocalizedAsync(strs.curgen_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[OwnerOnly]
|
||||
public Task GenCurList(int page = 1)
|
||||
public partial Task GenCurList(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
|
@@ -11,7 +11,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class ShopCommands : GamblingSubmodule<IShopService>
|
||||
public partial class ShopCommands : GamblingSubmodule<IShopService>
|
||||
{
|
||||
public enum List
|
||||
{
|
||||
@@ -65,10 +65,9 @@ public partial class Gambling
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Shop(int page = 1)
|
||||
public partial Task Shop(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -76,10 +75,9 @@ public partial class Gambling
|
||||
return ShopInternalAsync(page);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Buy(int index)
|
||||
public async partial Task Buy(int index)
|
||||
{
|
||||
index -= 1;
|
||||
if (index < 0)
|
||||
@@ -204,12 +202,11 @@ public partial class Gambling
|
||||
private static long GetProfitAmount(int price)
|
||||
=> (int)Math.Ceiling(0.90 * price);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
public async Task ShopAdd(Role _, int price, [Leftover] IRole role)
|
||||
public async partial Task ShopAdd(Role _, int price, [Leftover] IRole role)
|
||||
{
|
||||
if (price < 1)
|
||||
return;
|
||||
@@ -236,11 +233,10 @@ public partial class Gambling
|
||||
await ctx.Channel.EmbedAsync(EntryToEmbed(entry).WithTitle(GetText(strs.shop_item_add)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopAdd(List _, int price, [Leftover] string name)
|
||||
public async partial Task ShopAdd(List _, int price, [Leftover] string name)
|
||||
{
|
||||
if (price < 1)
|
||||
return;
|
||||
@@ -266,11 +262,10 @@ public partial class Gambling
|
||||
await ctx.Channel.EmbedAsync(EntryToEmbed(entry).WithTitle(GetText(strs.shop_item_add)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopListAdd(int index, [Leftover] string itemText)
|
||||
public async partial Task ShopListAdd(int index, [Leftover] string itemText)
|
||||
{
|
||||
index -= 1;
|
||||
if (index < 0)
|
||||
@@ -301,11 +296,10 @@ public partial class Gambling
|
||||
await ReplyConfirmLocalizedAsync(strs.shop_list_item_added);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopRemove(int index)
|
||||
public async partial Task ShopRemove(int index)
|
||||
{
|
||||
index -= 1;
|
||||
if (index < 0)
|
||||
@@ -332,11 +326,10 @@ public partial class Gambling
|
||||
await ctx.Channel.EmbedAsync(EntryToEmbed(removed).WithTitle(GetText(strs.shop_item_rm)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopChangePrice(int index, int price)
|
||||
public async partial Task ShopChangePrice(int index, int price)
|
||||
{
|
||||
if (--index < 0 || price <= 0)
|
||||
return;
|
||||
@@ -353,11 +346,10 @@ public partial class Gambling
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopChangeName(int index, [Leftover] string newName)
|
||||
public async partial Task ShopChangeName(int index, [Leftover] string newName)
|
||||
{
|
||||
if (--index < 0 || string.IsNullOrWhiteSpace(newName))
|
||||
return;
|
||||
@@ -374,11 +366,10 @@ public partial class Gambling
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopSwap(int index1, int index2)
|
||||
public async partial Task ShopSwap(int index1, int index2)
|
||||
{
|
||||
if (--index1 < 0 || --index2 < 0 || index1 == index2)
|
||||
return;
|
||||
@@ -395,11 +386,10 @@ public partial class Gambling
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ShopMove(int fromIndex, int toIndex)
|
||||
public async partial Task ShopMove(int fromIndex, int toIndex)
|
||||
{
|
||||
if (--fromIndex < 0 || --toIndex < 0 || fromIndex == toIndex)
|
||||
return;
|
||||
|
@@ -16,7 +16,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class SlotCommands : GamblingSubmodule<GamblingService>
|
||||
public partial class SlotCommands : GamblingSubmodule<GamblingService>
|
||||
{
|
||||
private static long _totalBet;
|
||||
private static long _totalPaidOut;
|
||||
@@ -46,10 +46,9 @@ public partial class Gambling
|
||||
public Task Test()
|
||||
=> Task.CompletedTask;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SlotStats()
|
||||
public async partial Task SlotStats()
|
||||
{
|
||||
//i remembered to not be a moron
|
||||
var paid = _totalPaidOut;
|
||||
@@ -68,10 +67,9 @@ public partial class Gambling
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task SlotTest(int tests = 1000)
|
||||
public async partial Task SlotTest(int tests = 1000)
|
||||
{
|
||||
if (tests <= 0)
|
||||
return;
|
||||
@@ -99,9 +97,8 @@ public partial class Gambling
|
||||
footer: $"Total Bet: {tests} | Payout: {payout} | {payout * 1.0f / tests * 100}%");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Slot(ShmartNumber amount)
|
||||
[Cmd]
|
||||
public async partial Task Slot(ShmartNumber amount)
|
||||
{
|
||||
if (!_runningUsers.Add(ctx.User.Id))
|
||||
return;
|
||||
|
@@ -8,16 +8,15 @@ namespace NadekoBot.Modules.Gambling;
|
||||
public partial class Gambling
|
||||
{
|
||||
[Group]
|
||||
public class WaifuClaimCommands : GamblingSubmodule<WaifuService>
|
||||
public partial class WaifuClaimCommands : GamblingSubmodule<WaifuService>
|
||||
{
|
||||
public WaifuClaimCommands(GamblingConfigService gamblingConfService)
|
||||
: base(gamblingConfService)
|
||||
{
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task WaifuReset()
|
||||
[Cmd]
|
||||
public async partial Task WaifuReset()
|
||||
{
|
||||
var price = _service.GetResetPrice(ctx.User);
|
||||
var embed = _eb.Create()
|
||||
@@ -36,10 +35,9 @@ public partial class Gambling
|
||||
await ReplyErrorLocalizedAsync(strs.waifu_reset_fail);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task WaifuClaim(int amount, [Leftover] IUser target)
|
||||
public async partial Task WaifuClaim(int amount, [Leftover] IUser target)
|
||||
{
|
||||
if (amount < _config.Waifu.MinPrice)
|
||||
{
|
||||
@@ -76,11 +74,10 @@ public partial class Gambling
|
||||
await SendConfirmAsync(ctx.User.Mention + msg);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task WaifuTransfer(ulong waifuId, IUser newOwner)
|
||||
public async partial Task WaifuTransfer(ulong waifuId, IUser newOwner)
|
||||
{
|
||||
if (!await _service.WaifuTransfer(ctx.User, waifuId, newOwner))
|
||||
{
|
||||
@@ -93,11 +90,10 @@ public partial class Gambling
|
||||
Format.Bold(newOwner.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task WaifuTransfer(IUser waifu, IUser newOwner)
|
||||
public async partial Task WaifuTransfer(IUser waifu, IUser newOwner)
|
||||
{
|
||||
if (!await _service.WaifuTransfer(ctx.User, waifu.Id, newOwner))
|
||||
{
|
||||
@@ -110,11 +106,10 @@ public partial class Gambling
|
||||
Format.Bold(newOwner.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(-1)]
|
||||
public Task Divorce([Leftover] string target)
|
||||
public partial Task Divorce([Leftover] string target)
|
||||
{
|
||||
var waifuUserId = _service.GetWaifuUserId(ctx.User.Id, target);
|
||||
if (waifuUserId == default) return ReplyErrorLocalizedAsync(strs.waifu_not_yours);
|
||||
@@ -122,18 +117,16 @@ public partial class Gambling
|
||||
return Divorce(waifuUserId);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public Task Divorce([Leftover] IGuildUser target)
|
||||
public partial Task Divorce([Leftover] IGuildUser target)
|
||||
=> Divorce(target.Id);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task Divorce([Leftover] ulong targetId)
|
||||
public async partial Task Divorce([Leftover] ulong targetId)
|
||||
{
|
||||
if (targetId == ctx.User.Id)
|
||||
return;
|
||||
@@ -153,10 +146,9 @@ public partial class Gambling
|
||||
Format.Bold(remaining?.Minutes.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Affinity([Leftover] IGuildUser u = null)
|
||||
public async partial Task Affinity([Leftover] IGuildUser u = null)
|
||||
{
|
||||
if (u?.Id == ctx.User.Id)
|
||||
{
|
||||
@@ -185,10 +177,9 @@ public partial class Gambling
|
||||
Format.Bold(u.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task WaifuLb(int page = 1)
|
||||
public async partial Task WaifuLb(int page = 1)
|
||||
{
|
||||
page--;
|
||||
|
||||
@@ -218,11 +209,10 @@ public partial class Gambling
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task WaifuInfo([Leftover] IUser target = null)
|
||||
public partial Task WaifuInfo([Leftover] IUser target = null)
|
||||
{
|
||||
if (target is null)
|
||||
target = ctx.User;
|
||||
@@ -230,11 +220,10 @@ public partial class Gambling
|
||||
return InternalWaifuInfo(target.Id, target.ToString());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public Task WaifuInfo(ulong targetId)
|
||||
public partial Task WaifuInfo(ulong targetId)
|
||||
=> InternalWaifuInfo(targetId);
|
||||
|
||||
private Task InternalWaifuInfo(ulong targetId, string name = null)
|
||||
@@ -284,11 +273,10 @@ public partial class Gambling
|
||||
return ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task WaifuGift(int page = 1)
|
||||
public async partial Task WaifuGift(int page = 1)
|
||||
{
|
||||
if (--page < 0 || page > (_config.Waifu.Items.Count - 1) / 9)
|
||||
return;
|
||||
@@ -315,11 +303,10 @@ public partial class Gambling
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task WaifuGift(string itemName, [Leftover] IUser waifu)
|
||||
public async partial Task WaifuGift(string itemName, [Leftover] IUser waifu)
|
||||
{
|
||||
if (waifu.Id == ctx.User.Id)
|
||||
return;
|
||||
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Gambling;
|
||||
|
||||
public partial class Gambling
|
||||
{
|
||||
public class WheelOfFortuneCommands : GamblingSubmodule<GamblingService>
|
||||
public partial class WheelOfFortuneCommands : GamblingSubmodule<GamblingService>
|
||||
{
|
||||
private static readonly ImmutableArray<string> _emojis =
|
||||
new[] { "⬆", "↖", "⬅", "↙", "⬇", "↘", "➡", "↗" }.ToImmutableArray();
|
||||
@@ -23,9 +23,8 @@ public partial class Gambling
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task WheelOfFortune(ShmartNumber amount)
|
||||
[Cmd]
|
||||
public async partial Task WheelOfFortune(ShmartNumber amount)
|
||||
{
|
||||
if (!await CheckBetMandatory(amount))
|
||||
return;
|
||||
|
@@ -8,18 +8,17 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class AcropobiaCommands : NadekoSubmodule<GamesService>
|
||||
public partial class AcropobiaCommands : NadekoSubmodule<GamesService>
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
|
||||
public AcropobiaCommands(DiscordSocketClient client)
|
||||
=> _client = client;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoOptions(typeof(AcrophobiaGame.Options))]
|
||||
public async Task Acrophobia(params string[] args)
|
||||
public async partial Task Acrophobia(params string[] args)
|
||||
{
|
||||
var (options, _) = OptionsParser.ParseFrom(new AcrophobiaGame.Options(), args);
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class ChatterBotCommands : NadekoSubmodule<ChatterBotService>
|
||||
public partial class ChatterBotCommands : NadekoSubmodule<ChatterBotService>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
|
||||
@@ -15,11 +15,10 @@ public partial class Games
|
||||
=> _db = db;
|
||||
|
||||
[NoPublicBot]
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task Cleverbot()
|
||||
public async partial Task Cleverbot()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
|
@@ -20,9 +20,8 @@ public partial class Games : NadekoModule<GamesService>
|
||||
_httpFactory = factory;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Choose([Leftover] string list = null)
|
||||
[Cmd]
|
||||
public async partial Task Choose([Leftover] string list = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(list))
|
||||
return;
|
||||
@@ -33,9 +32,8 @@ public partial class Games : NadekoModule<GamesService>
|
||||
await SendConfirmAsync("🤔", listArr[rng.Next(0, listArr.Length)]);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task EightBall([Leftover] string question = null)
|
||||
[Cmd]
|
||||
public async partial Task EightBall([Leftover] string question = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(question))
|
||||
return;
|
||||
@@ -48,10 +46,9 @@ public partial class Games : NadekoModule<GamesService>
|
||||
.AddField("🎱 " + GetText(strs._8ball), res));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RateGirl([Leftover] IGuildUser usr)
|
||||
public async partial Task RateGirl([Leftover] IGuildUser usr)
|
||||
{
|
||||
var gr = _service.GirlRatings.GetOrAdd(usr.Id, GetGirl);
|
||||
var originalStream = await gr.Stream;
|
||||
@@ -141,9 +138,8 @@ public partial class Games : NadekoModule<GamesService>
|
||||
return new(_images, _httpFactory, crazy, hot, roll, advice);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Linux(string guhnoo, string loonix)
|
||||
[Cmd]
|
||||
public async partial Task Linux(string guhnoo, string loonix)
|
||||
=> await SendConfirmAsync(
|
||||
$@"I'd just like to interject for moment. What you're refering to as {loonix}, is in fact, {guhnoo}/{loonix}, or as I've recently taken to calling it, {guhnoo} plus {loonix}. {loonix} is not an operating system unto itself, but rather another free component of a fully functioning {guhnoo} system made useful by the {guhnoo} corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
|
||||
|
||||
|
@@ -5,12 +5,11 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class HangmanCommands : NadekoSubmodule<IHangmanService>
|
||||
public partial class HangmanCommands : NadekoSubmodule<IHangmanService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Hangmanlist()
|
||||
public async partial Task Hangmanlist()
|
||||
=> await SendConfirmAsync(GetText(strs.hangman_types(Prefix)), _service.GetHangmanTypes().Join('\n'));
|
||||
|
||||
private static string Draw(HangmanGame.State state)
|
||||
@@ -44,10 +43,9 @@ public partial class Games
|
||||
.WithFooter(state.missedLetters.Join(' '));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Hangman([Leftover] string? type = null)
|
||||
public async partial Task Hangman([Leftover] string? type = null)
|
||||
{
|
||||
if (!_service.StartHangman(ctx.Channel.Id, type, out var hangman))
|
||||
{
|
||||
@@ -60,10 +58,9 @@ public partial class Games
|
||||
await ctx.Channel.EmbedAsync(eb);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task HangmanStop()
|
||||
public async partial Task HangmanStop()
|
||||
{
|
||||
if (await _service.StopHangman(ctx.Channel.Id)) await ReplyConfirmLocalizedAsync(strs.hangman_stopped);
|
||||
}
|
||||
|
@@ -7,17 +7,16 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class NunchiCommands : NadekoSubmodule<GamesService>
|
||||
public partial class NunchiCommands : NadekoSubmodule<GamesService>
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
|
||||
public NunchiCommands(DiscordSocketClient client)
|
||||
=> _client = client;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Nunchi()
|
||||
public async partial Task Nunchi()
|
||||
{
|
||||
var newNunchi = new NunchiGame(ctx.User.Id, ctx.User.ToString());
|
||||
NunchiGame nunchi;
|
||||
|
@@ -8,18 +8,17 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class PollCommands : NadekoSubmodule<PollService>
|
||||
public partial class PollCommands : NadekoSubmodule<PollService>
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
|
||||
public PollCommands(DiscordSocketClient client)
|
||||
=> _client = client;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Poll([Leftover] string arg)
|
||||
public async partial Task Poll([Leftover] string arg)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(arg))
|
||||
return;
|
||||
@@ -44,11 +43,10 @@ public partial class Games
|
||||
await ReplyErrorLocalizedAsync(strs.poll_already_running);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task PollStats()
|
||||
public async partial Task PollStats()
|
||||
{
|
||||
if (!_service.ActivePolls.TryGetValue(ctx.Guild.Id, out var pr))
|
||||
return;
|
||||
@@ -56,11 +54,10 @@ public partial class Games
|
||||
await ctx.Channel.EmbedAsync(GetStats(pr.Poll, GetText(strs.current_poll_results)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Pollend()
|
||||
public async partial Task Pollend()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class SpeedTypingCommands : NadekoSubmodule<GamesService>
|
||||
public partial class SpeedTypingCommands : NadekoSubmodule<GamesService>
|
||||
{
|
||||
private readonly GamesService _games;
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -18,11 +18,10 @@ public partial class Games
|
||||
_client = client;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoOptionsAttribute(typeof(TypingGame.Options))]
|
||||
public async Task TypeStart(params string[] args)
|
||||
public async partial Task TypeStart(params string[] args)
|
||||
{
|
||||
var (options, _) = OptionsParser.ParseFrom(new TypingGame.Options(), args);
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
@@ -36,10 +35,9 @@ public partial class Games
|
||||
await game.Start();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task TypeStop()
|
||||
public async partial Task TypeStop()
|
||||
{
|
||||
if (_service.RunningContests.TryRemove(ctx.Guild.Id, out var game))
|
||||
{
|
||||
@@ -51,11 +49,10 @@ public partial class Games
|
||||
}
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task Typeadd([Leftover] string text)
|
||||
public async partial Task Typeadd([Leftover] string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
@@ -65,10 +62,9 @@ public partial class Games
|
||||
await SendConfirmAsync("Added new article for typing game.");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Typelist(int page = 1)
|
||||
public async partial Task Typelist(int page = 1)
|
||||
{
|
||||
if (page < 1)
|
||||
return;
|
||||
@@ -86,11 +82,10 @@ public partial class Games
|
||||
string.Join("\n", articles.Select(a => $"`#{++i}` - {a.Text.TrimTo(50)}")));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task Typedel(int index)
|
||||
public async partial Task Typedel(int index)
|
||||
{
|
||||
var removed = _service.RemoveTypingArticle(--index);
|
||||
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class TicTacToeCommands : NadekoSubmodule<GamesService>
|
||||
public partial class TicTacToeCommands : NadekoSubmodule<GamesService>
|
||||
{
|
||||
private readonly SemaphoreSlim _sem = new(1, 1);
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -15,11 +15,10 @@ public partial class Games
|
||||
public TicTacToeCommands(DiscordSocketClient client)
|
||||
=> _client = client;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[NadekoOptions(typeof(TicTacToe.Options))]
|
||||
public async Task TicTacToe(params string[] args)
|
||||
public async partial Task TicTacToe(params string[] args)
|
||||
{
|
||||
var (options, _) = OptionsParser.ParseFrom(new TicTacToe.Options(), args);
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Games;
|
||||
public partial class Games
|
||||
{
|
||||
[Group]
|
||||
public class TriviaCommands : NadekoSubmodule<GamesService>
|
||||
public partial class TriviaCommands : NadekoSubmodule<GamesService>
|
||||
{
|
||||
private readonly IDataCache _cache;
|
||||
private readonly ICurrencyService _cs;
|
||||
@@ -26,15 +26,14 @@ public partial class Games
|
||||
_client = client;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
[NadekoOptionsAttribute(typeof(TriviaOptions))]
|
||||
public Task Trivia(params string[] args)
|
||||
public partial Task Trivia(params string[] args)
|
||||
=> InternalTrivia(args);
|
||||
|
||||
public async Task InternalTrivia(params string[] args)
|
||||
private async Task InternalTrivia(params string[] args)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -71,10 +70,9 @@ public partial class Games
|
||||
await SendErrorAsync(GetText(strs.trivia_already_running) + "\n" + trivia.CurrentQuestion);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Tl()
|
||||
public async partial Task Tl()
|
||||
{
|
||||
if (_service.RunningTrivias.TryGetValue(ctx.Guild.Id, out var trivia))
|
||||
{
|
||||
@@ -85,10 +83,9 @@ public partial class Games
|
||||
await ReplyErrorLocalizedAsync(strs.trivia_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Tq()
|
||||
public async partial Task Tq()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
|
@@ -10,7 +10,7 @@ using JsonSerializer = System.Text.Json.JsonSerializer;
|
||||
|
||||
namespace NadekoBot.Modules.Help;
|
||||
|
||||
public class Help : NadekoModule<HelpService>
|
||||
public partial class Help : NadekoModule<HelpService>
|
||||
{
|
||||
public const string PatreonUrl = "https://patreon.com/nadekobot";
|
||||
public const string PaypalUrl = "https://paypal.me/Kwoth";
|
||||
@@ -59,9 +59,8 @@ public class Help : NadekoModule<HelpService>
|
||||
return r.Replace(text);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Modules(int page = 1)
|
||||
[Cmd]
|
||||
public async partial Task Modules(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -162,10 +161,9 @@ public class Help : NadekoModule<HelpService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[NadekoOptions(typeof(CommandsOptions))]
|
||||
public async Task Commands(string module = null, params string[] args)
|
||||
public async partial Task Commands(string module = null, params string[] args)
|
||||
{
|
||||
module = module?.Trim().ToUpperInvariant();
|
||||
if (string.IsNullOrWhiteSpace(module))
|
||||
@@ -255,10 +253,9 @@ public class Help : NadekoModule<HelpService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task H([Leftover] string fail)
|
||||
public async partial Task H([Leftover] string fail)
|
||||
{
|
||||
var prefixless =
|
||||
_cmds.Commands.FirstOrDefault(x => x.Aliases.Any(cmdName => cmdName.ToLowerInvariant() == fail));
|
||||
@@ -271,10 +268,9 @@ public class Help : NadekoModule<HelpService>
|
||||
await ReplyErrorLocalizedAsync(strs.command_not_found);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task H([Leftover] CommandInfo com = null)
|
||||
public async partial Task H([Leftover] CommandInfo com = null)
|
||||
{
|
||||
var channel = ctx.Channel;
|
||||
|
||||
@@ -302,10 +298,9 @@ public class Help : NadekoModule<HelpService>
|
||||
await channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task GenCmdList()
|
||||
public async partial Task GenCmdList()
|
||||
{
|
||||
_ = ctx.Channel.TriggerTypingAsync();
|
||||
|
||||
@@ -408,15 +403,13 @@ public class Help : NadekoModule<HelpService>
|
||||
await ctx.Channel.SendFileAsync(rDataStream, "cmds.json", GetText(strs.commandlist_regen));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Guide()
|
||||
[Cmd]
|
||||
public async partial Task Guide()
|
||||
=> await ConfirmLocalizedAsync(strs.guide("https://nadeko.bot/commands",
|
||||
"http://nadekobot.readthedocs.io/en/latest/"));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Donate()
|
||||
[Cmd]
|
||||
public async partial Task Donate()
|
||||
=> await ReplyConfirmLocalizedAsync(strs.donate(PatreonUrl, PaypalUrl));
|
||||
}
|
||||
|
||||
|
@@ -153,10 +153,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
|
||||
// join vc
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Join()
|
||||
public async partial Task Join()
|
||||
{
|
||||
var user = (IGuildUser)ctx.User;
|
||||
|
||||
@@ -172,10 +171,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
|
||||
// leave vc (destroy)
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Destroy()
|
||||
public async partial Task Destroy()
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -185,45 +183,39 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
|
||||
// play - no args = next
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(2)]
|
||||
public Task Play()
|
||||
public partial Task Play()
|
||||
=> Next();
|
||||
|
||||
// play - index = skip to that index
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task Play(int index)
|
||||
public partial Task Play(int index)
|
||||
=> MoveToIndex(index);
|
||||
|
||||
// play - query = q(query)
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public Task Play([Leftover] string query)
|
||||
public partial Task Play([Leftover] string query)
|
||||
=> QueueByQuery(query);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Queue([Leftover] string query)
|
||||
public partial Task Queue([Leftover] string query)
|
||||
=> QueueByQuery(query);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task QueueNext([Leftover] string query)
|
||||
public partial Task QueueNext([Leftover] string query)
|
||||
=> QueueByQuery(query, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Volume(int vol)
|
||||
public async partial Task Volume(int vol)
|
||||
{
|
||||
if (vol is < 0 or > 100)
|
||||
{
|
||||
@@ -239,10 +231,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ReplyConfirmLocalizedAsync(strs.volume_set(vol));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Next()
|
||||
public async partial Task Next()
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -253,10 +244,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
|
||||
// list queue, relevant page
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ListQueue()
|
||||
public async partial Task ListQueue()
|
||||
{
|
||||
// show page with the current song
|
||||
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
|
||||
@@ -269,10 +259,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
|
||||
// list queue, specify page
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ListQueue(int page)
|
||||
public async partial Task ListQueue(int page)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -341,10 +330,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
|
||||
// search
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QueueSearch([Leftover] string query)
|
||||
public async partial Task QueueSearch([Leftover] string query)
|
||||
{
|
||||
_ = ctx.Channel.TriggerTypingAsync();
|
||||
|
||||
@@ -394,11 +382,10 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public async Task TrackRemove(int index)
|
||||
public async partial Task TrackRemove(int index)
|
||||
{
|
||||
if (index < 1)
|
||||
{
|
||||
@@ -431,11 +418,10 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await _service.SendToOutputAsync(ctx.Guild.Id, embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task TrackRemove(All _ = All.All)
|
||||
public async partial Task TrackRemove(All _ = All.All)
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -451,10 +437,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ReplyConfirmLocalizedAsync(strs.queue_cleared);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Stop()
|
||||
public async partial Task Stop()
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -478,10 +463,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
_ => PlayerRepeatType.Queue
|
||||
};
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QueueRepeat(InputRepeatType type = InputRepeatType.Queue)
|
||||
public async partial Task QueueRepeat(InputRepeatType type = InputRepeatType.Queue)
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -497,10 +481,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ReplyConfirmLocalizedAsync(strs.repeating_track);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Pause()
|
||||
public async partial Task Pause()
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -515,24 +498,21 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
mp.TogglePause();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task Radio(string radioLink)
|
||||
public partial Task Radio(string radioLink)
|
||||
=> QueueByQuery(radioLink, false, MusicPlatform.Radio);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public Task Local([Leftover] string path)
|
||||
public partial Task Local([Leftover] string path)
|
||||
=> QueueByQuery(path, false, MusicPlatform.Local);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task LocalPlaylist([Leftover] string dirPath)
|
||||
public async partial Task LocalPlaylist([Leftover] string dirPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(dirPath))
|
||||
return;
|
||||
@@ -569,10 +549,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ReplyConfirmLocalizedAsync(strs.dir_queue_complete);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task MoveSong(int from, int to)
|
||||
public async partial Task MoveSong(int from, int to)
|
||||
{
|
||||
if (--from < 0 || --to < 0 || from == to)
|
||||
{
|
||||
@@ -611,16 +590,14 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public Task SoundCloudQueue([Leftover] string query)
|
||||
public partial Task SoundCloudQueue([Leftover] string query)
|
||||
=> QueueByQuery(query, false, MusicPlatform.SoundCloud);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SoundCloudPl([Leftover] string playlist)
|
||||
public async partial Task SoundCloudPl([Leftover] string playlist)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(playlist))
|
||||
return;
|
||||
@@ -643,10 +620,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Playlist([Leftover] string playlistQuery)
|
||||
public async partial Task Playlist([Leftover] string playlistQuery)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(playlistQuery))
|
||||
return;
|
||||
@@ -675,10 +651,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task NowPlaying()
|
||||
public async partial Task NowPlaying()
|
||||
{
|
||||
var mp = await _service.GetOrCreateMusicPlayerAsync((ITextChannel)ctx.Channel);
|
||||
if (mp is null)
|
||||
@@ -702,10 +677,9 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task PlaylistShuffle()
|
||||
public async partial Task PlaylistShuffle()
|
||||
{
|
||||
var valid = await ValidateAsync();
|
||||
if (!valid)
|
||||
@@ -722,32 +696,29 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ReplyConfirmLocalizedAsync(strs.queue_shuffled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task SetMusicChannel()
|
||||
public async partial Task SetMusicChannel()
|
||||
{
|
||||
await _service.SetMusicChannelAsync(ctx.Guild.Id, ctx.Channel.Id);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.set_music_channel);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task UnsetMusicChannel()
|
||||
public async partial Task UnsetMusicChannel()
|
||||
{
|
||||
await _service.SetMusicChannelAsync(ctx.Guild.Id, null);
|
||||
|
||||
await ReplyConfirmLocalizedAsync(strs.unset_music_channel);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AutoDisconnect()
|
||||
public async partial Task AutoDisconnect()
|
||||
{
|
||||
var newState = await _service.ToggleAutoDisconnectAsync(ctx.Guild.Id);
|
||||
|
||||
@@ -757,21 +728,19 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
||||
await ReplyConfirmLocalizedAsync(strs.autodc_disable);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task MusicQuality()
|
||||
public async partial Task MusicQuality()
|
||||
{
|
||||
var quality = await _service.GetMusicQualityAsync(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.current_music_quality(Format.Bold(quality.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task MusicQuality(QualityPreset preset)
|
||||
public async partial Task MusicQuality(QualityPreset preset)
|
||||
{
|
||||
await _service.SetMusicQualityAsync(ctx.Guild.Id, preset);
|
||||
await ReplyConfirmLocalizedAsync(strs.music_quality_set(Format.Bold(preset.ToString())));
|
||||
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Music;
|
||||
public sealed partial class Music
|
||||
{
|
||||
[Group]
|
||||
public sealed class PlaylistCommands : NadekoModule<IMusicService>
|
||||
public sealed partial class PlaylistCommands : NadekoModule<IMusicService>
|
||||
{
|
||||
private static readonly SemaphoreSlim _playlistLock = new(1, 1);
|
||||
private readonly DbService _db;
|
||||
@@ -35,10 +35,9 @@ public sealed partial class Music
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Playlists([Leftover] int num = 1)
|
||||
public async partial Task Playlists([Leftover] int num = 1)
|
||||
{
|
||||
if (num <= 0)
|
||||
return;
|
||||
@@ -59,10 +58,9 @@ public sealed partial class Music
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task DeletePlaylist([Leftover] int id)
|
||||
public async partial Task DeletePlaylist([Leftover] int id)
|
||||
{
|
||||
var success = false;
|
||||
try
|
||||
@@ -89,10 +87,9 @@ public sealed partial class Music
|
||||
await ReplyConfirmLocalizedAsync(strs.playlist_deleted);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task PlaylistShow(int id, int page = 1)
|
||||
public async partial Task PlaylistShow(int id, int page = 1)
|
||||
{
|
||||
if (page-- < 1)
|
||||
return;
|
||||
@@ -117,10 +114,9 @@ public sealed partial class Music
|
||||
20);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Save([Leftover] string name)
|
||||
public async partial Task Save([Leftover] string name)
|
||||
{
|
||||
if (!_service.TryGetMusicPlayer(ctx.Guild.Id, out var mp))
|
||||
{
|
||||
@@ -156,10 +152,9 @@ public sealed partial class Music
|
||||
.AddField(GetText(strs.id), playlist.Id.ToString()));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Load([Leftover] int id)
|
||||
public async partial Task Load([Leftover] int id)
|
||||
{
|
||||
// expensive action, 1 at a time
|
||||
await _playlistLock.WaitAsync();
|
||||
|
@@ -5,7 +5,7 @@ using Newtonsoft.Json.Linq;
|
||||
namespace NadekoBot.Modules.Nsfw;
|
||||
|
||||
[NoPublicBot]
|
||||
public class NSFW : NadekoModule<ISearchImagesService>
|
||||
public partial class NSFW : NadekoModule<ISearchImagesService>
|
||||
{
|
||||
private static readonly ConcurrentHashSet<ulong> _hentaiBombBlacklist = new();
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
@@ -55,12 +55,11 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
public async Task AutoHentai(int interval = 0, [Leftover] string tags = null)
|
||||
public async partial Task AutoHentai(int interval = 0, [Leftover] string tags = null)
|
||||
{
|
||||
Timer t;
|
||||
|
||||
@@ -111,12 +110,11 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
await ReplyConfirmLocalizedAsync(strs.autohentai_started(interval, string.Join(", ", tags)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
public async Task AutoBoobs(int interval = 0)
|
||||
public async partial Task AutoBoobs(int interval = 0)
|
||||
{
|
||||
Timer t;
|
||||
|
||||
@@ -158,12 +156,11 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
await ReplyConfirmLocalizedAsync(strs.started(interval));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
[UserPerm(ChannelPerm.ManageMessages)]
|
||||
public async Task AutoButts(int interval = 0)
|
||||
public async partial Task AutoButts(int interval = 0)
|
||||
{
|
||||
Timer t;
|
||||
|
||||
@@ -205,18 +202,16 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
await ReplyConfirmLocalizedAsync(strs.started(interval));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Hentai(params string[] tags)
|
||||
public partial Task Hentai(params string[] tags)
|
||||
=> InternalDapiCommand(tags, true, _service.Hentai);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public async Task HentaiBomb(params string[] tags)
|
||||
public async partial Task HentaiBomb(params string[] tags)
|
||||
{
|
||||
if (!_hentaiBombBlacklist.Add(ctx.Guild?.Id ?? ctx.User.Id))
|
||||
return;
|
||||
@@ -242,74 +237,64 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Yandere(params string[] tags)
|
||||
public partial Task Yandere(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.Yandere);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Konachan(params string[] tags)
|
||||
public partial Task Konachan(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.Konachan);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Sankaku(params string[] tags)
|
||||
public partial Task Sankaku(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.Sankaku);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task E621(params string[] tags)
|
||||
public partial Task E621(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.E621);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Rule34(params string[] tags)
|
||||
public partial Task Rule34(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.Rule34);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Danbooru(params string[] tags)
|
||||
public partial Task Danbooru(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.Danbooru);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Gelbooru(params string[] tags)
|
||||
public partial Task Gelbooru(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.Gelbooru);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Derpibooru(params string[] tags)
|
||||
public partial Task Derpibooru(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.DerpiBooru);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public Task Safebooru(params string[] tags)
|
||||
public partial Task Safebooru(params string[] tags)
|
||||
=> InternalDapiCommand(tags, false, _service.SafeBooru);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public async Task Boobs()
|
||||
public async partial Task Boobs()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -328,11 +313,10 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
public async Task Butts()
|
||||
public async partial Task Butts()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -351,11 +335,10 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task NsfwTagBlacklist([Leftover] string tag = null)
|
||||
public async partial Task NsfwTagBlacklist([Leftover] string tag = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(tag))
|
||||
{
|
||||
@@ -374,13 +357,12 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
[Priority(1)]
|
||||
public async Task Nhentai(uint id)
|
||||
public async partial Task Nhentai(uint id)
|
||||
{
|
||||
var g = await _service.GetNhentaiByIdAsync(id);
|
||||
|
||||
@@ -393,13 +375,12 @@ public class NSFW : NadekoModule<ISearchImagesService>
|
||||
await SendNhentaiGalleryInternalAsync(g);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireNsfw(Group = "nsfw_or_dm")]
|
||||
[RequireContext(ContextType.DM, Group = "nsfw_or_dm")]
|
||||
[Priority(0)]
|
||||
public async Task Nhentai([Leftover] string query)
|
||||
public async partial Task Nhentai([Leftover] string query)
|
||||
{
|
||||
var g = await _service.GetNhentaiBySearchAsync(query);
|
||||
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Permissions;
|
||||
public partial class Permissions
|
||||
{
|
||||
[Group]
|
||||
public class BlacklistCommands : NadekoSubmodule<BlacklistService>
|
||||
public partial class BlacklistCommands : NadekoSubmodule<BlacklistService>
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
|
||||
@@ -66,10 +66,9 @@ public partial class Permissions
|
||||
10);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task UserBlacklist(int page = 1)
|
||||
public partial Task UserBlacklist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -77,10 +76,9 @@ public partial class Permissions
|
||||
return ListBlacklistInternal(GetText(strs.blacklisted_users), BlacklistType.User, page);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task ChannelBlacklist(int page = 1)
|
||||
public partial Task ChannelBlacklist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -88,10 +86,9 @@ public partial class Permissions
|
||||
return ListBlacklistInternal(GetText(strs.blacklisted_channels), BlacklistType.Channel, page);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task ServerBlacklist(int page = 1)
|
||||
public partial Task ServerBlacklist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return Task.CompletedTask;
|
||||
@@ -99,34 +96,29 @@ public partial class Permissions
|
||||
return ListBlacklistInternal(GetText(strs.blacklisted_servers), BlacklistType.Server, page);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task UserBlacklist(AddRemove action, ulong id)
|
||||
public partial Task UserBlacklist(AddRemove action, ulong id)
|
||||
=> Blacklist(action, id, BlacklistType.User);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task UserBlacklist(AddRemove action, IUser usr)
|
||||
public partial Task UserBlacklist(AddRemove action, IUser usr)
|
||||
=> Blacklist(action, usr.Id, BlacklistType.User);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task ChannelBlacklist(AddRemove action, ulong id)
|
||||
public partial Task ChannelBlacklist(AddRemove action, ulong id)
|
||||
=> Blacklist(action, id, BlacklistType.Channel);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task ServerBlacklist(AddRemove action, ulong id)
|
||||
public partial Task ServerBlacklist(AddRemove action, ulong id)
|
||||
=> Blacklist(action, id, BlacklistType.Server);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public Task ServerBlacklist(AddRemove action, IGuild guild)
|
||||
public partial Task ServerBlacklist(AddRemove action, IGuild guild)
|
||||
=> Blacklist(action, guild.Id, BlacklistType.Server);
|
||||
|
||||
private async Task Blacklist(AddRemove action, ulong id, BlacklistType type)
|
||||
|
@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Permissions;
|
||||
public partial class Permissions
|
||||
{
|
||||
[Group]
|
||||
public class CmdCdsCommands : NadekoSubmodule
|
||||
public partial class CmdCdsCommands : NadekoSubmodule
|
||||
{
|
||||
private ConcurrentDictionary<ulong, ConcurrentHashSet<CommandCooldown>> CommandCooldowns
|
||||
=> _service.CommandCooldowns;
|
||||
@@ -27,10 +27,9 @@ public partial class Permissions
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task CmdCooldown(CommandOrCrInfo command, int secs)
|
||||
public async partial Task CmdCooldown(CommandOrCrInfo command, int secs)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
if (secs is < 0 or > 3600)
|
||||
@@ -71,10 +70,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AllCmdCooldowns()
|
||||
public async partial Task AllCmdCooldowns()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
var localSet = CommandCooldowns.GetOrAdd(channel.Guild.Id, new ConcurrentHashSet<CommandCooldown>());
|
||||
|
@@ -9,27 +9,25 @@ namespace NadekoBot.Modules.Permissions;
|
||||
public partial class Permissions
|
||||
{
|
||||
[Group]
|
||||
public class FilterCommands : NadekoSubmodule<FilterService>
|
||||
public partial class FilterCommands : NadekoSubmodule<FilterService>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
|
||||
public FilterCommands(DbService db)
|
||||
=> _db = db;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task FwClear()
|
||||
public async partial Task FwClear()
|
||||
{
|
||||
_service.ClearFilteredWords(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.fw_cleared);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SrvrFilterInv()
|
||||
public async partial Task SrvrFilterInv()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -53,10 +51,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChnlFilterInv()
|
||||
public async partial Task ChnlFilterInv()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -87,10 +84,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SrvrFilterLin()
|
||||
public async partial Task SrvrFilterLin()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -114,10 +110,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChnlFilterLin()
|
||||
public async partial Task ChnlFilterLin()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -148,10 +143,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SrvrFilterWords()
|
||||
public async partial Task SrvrFilterWords()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -175,10 +169,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChnlFilterWords()
|
||||
public async partial Task ChnlFilterWords()
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -209,10 +202,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task FilterWord([Leftover] string word)
|
||||
public async partial Task FilterWord([Leftover] string word)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -251,10 +243,9 @@ public partial class Permissions
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task LstFilterWords(int page = 1)
|
||||
public async partial Task LstFilterWords(int page = 1)
|
||||
{
|
||||
page--;
|
||||
if (page < 0)
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Permissions;
|
||||
public partial class Permissions
|
||||
{
|
||||
[Group]
|
||||
public class GlobalPermissionCommands : NadekoSubmodule
|
||||
public partial class GlobalPermissionCommands : NadekoSubmodule
|
||||
{
|
||||
private GlobalPermissionService _service;
|
||||
private readonly DbService _db;
|
||||
@@ -18,10 +18,9 @@ public partial class Permissions
|
||||
_db = db;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task GlobalPermList()
|
||||
public async partial Task GlobalPermList()
|
||||
{
|
||||
var blockedModule = _service.BlockedModules;
|
||||
var blockedCommands = _service.BlockedCommands;
|
||||
@@ -42,10 +41,9 @@ public partial class Permissions
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task GlobalModule(ModuleOrCrInfo module)
|
||||
public async partial Task GlobalModule(ModuleOrCrInfo module)
|
||||
{
|
||||
var moduleName = module.Name.ToLowerInvariant();
|
||||
|
||||
@@ -60,10 +58,9 @@ public partial class Permissions
|
||||
await ReplyConfirmLocalizedAsync(strs.gmod_remove(Format.Bold(module.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task GlobalCommand(CommandOrCrInfo cmd)
|
||||
public async partial Task GlobalCommand(CommandOrCrInfo cmd)
|
||||
{
|
||||
var commandName = cmd.Name.ToLowerInvariant();
|
||||
var added = _service.ToggleCommand(commandName);
|
||||
|
@@ -17,10 +17,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
public Permissions(DbService db)
|
||||
=> _db = db;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Verbose(PermissionAction action = null)
|
||||
public async partial Task Verbose(PermissionAction action = null)
|
||||
{
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
@@ -37,12 +36,11 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.verbose_false);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public async Task PermRole([Leftover] IRole role = null)
|
||||
public async partial Task PermRole([Leftover] IRole role = null)
|
||||
{
|
||||
if (role != null && role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -69,12 +67,11 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.permrole_changed(Format.Bold(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(1)]
|
||||
public async Task PermRole(Reset _)
|
||||
public async partial Task PermRole(Reset _)
|
||||
{
|
||||
await using (var uow = _db.GetDbContext())
|
||||
{
|
||||
@@ -87,10 +84,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.permrole_reset);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ListPerms(int page = 1)
|
||||
public async partial Task ListPerms(int page = 1)
|
||||
{
|
||||
if (page < 1)
|
||||
return;
|
||||
@@ -121,10 +117,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ctx.Channel.SendMessageAsync(toSend);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RemovePerm(int index)
|
||||
public async partial Task RemovePerm(int index)
|
||||
{
|
||||
index -= 1;
|
||||
if (index < 0)
|
||||
@@ -152,10 +147,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task MovePerm(int from, int to)
|
||||
public async partial Task MovePerm(int from, int to)
|
||||
{
|
||||
from -= 1;
|
||||
to -= 1;
|
||||
@@ -205,10 +199,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.perm_out_of_range);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SrvrCmd(CommandOrCrInfo command, PermissionAction action)
|
||||
public async partial Task SrvrCmd(CommandOrCrInfo command, PermissionAction action)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -227,10 +220,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.sx_disable(Format.Code(command.Name), GetText(strs.of_command)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task SrvrMdl(ModuleOrCrInfo module, PermissionAction action)
|
||||
public async partial Task SrvrMdl(ModuleOrCrInfo module, PermissionAction action)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -248,10 +240,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.sx_disable(Format.Code(module.Name), GetText(strs.of_module)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task UsrCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] IGuildUser user)
|
||||
public async partial Task UsrCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] IGuildUser user)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -274,10 +265,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
Format.Code(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task UsrMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IGuildUser user)
|
||||
public async partial Task UsrMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IGuildUser user)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -299,10 +289,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
Format.Code(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RoleCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] IRole role)
|
||||
public async partial Task RoleCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -328,10 +317,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
Format.Code(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task RoleMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IRole role)
|
||||
public async partial Task RoleMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -357,10 +345,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
Format.Code(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChnlCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
public async partial Task ChnlCmd(CommandOrCrInfo command, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -383,10 +370,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
Format.Code(chnl.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChnlMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
public async partial Task ChnlMdl(ModuleOrCrInfo module, PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -408,10 +394,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
Format.Code(chnl.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AllChnlMdls(PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
public async partial Task AllChnlMdls(PermissionAction action, [Leftover] ITextChannel chnl)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -429,10 +414,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.acm_disable(Format.Code(chnl.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AllRoleMdls(PermissionAction action, [Leftover] IRole role)
|
||||
public async partial Task AllRoleMdls(PermissionAction action, [Leftover] IRole role)
|
||||
{
|
||||
if (role == role.Guild.EveryoneRole)
|
||||
return;
|
||||
@@ -453,10 +437,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.arm_disable(Format.Code(role.Name)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AllUsrMdls(PermissionAction action, [Leftover] IUser user)
|
||||
public async partial Task AllUsrMdls(PermissionAction action, [Leftover] IUser user)
|
||||
{
|
||||
await _service.AddPermissions(ctx.Guild.Id,
|
||||
new Permissionv2
|
||||
@@ -474,10 +457,9 @@ public partial class Permissions : NadekoModule<PermissionService>
|
||||
await ReplyConfirmLocalizedAsync(strs.aum_disable(Format.Code(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AllSrvrMdls(PermissionAction action)
|
||||
public async partial Task AllSrvrMdls(PermissionAction action)
|
||||
{
|
||||
var newPerm = new Permissionv2
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Permissions;
|
||||
public partial class Permissions
|
||||
{
|
||||
[Group]
|
||||
public class ResetPermissionsCommands : NadekoSubmodule
|
||||
public partial class ResetPermissionsCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly GlobalPermissionService _gps;
|
||||
private readonly PermissionService _perms;
|
||||
@@ -17,20 +17,18 @@ public partial class Permissions
|
||||
_perms = perms;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task ResetPerms()
|
||||
public async partial Task ResetPerms()
|
||||
{
|
||||
await _perms.Reset(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.perms_reset);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ResetGlobalPerms()
|
||||
public async partial Task ResetGlobalPerms()
|
||||
{
|
||||
await _gps.Reset();
|
||||
await ReplyConfirmLocalizedAsync(strs.global_perms_reset);
|
||||
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService>
|
||||
public partial class AnimeSearchCommands : NadekoSubmodule<AnimeSearchService>
|
||||
{
|
||||
// [NadekoCommand, Aliases]
|
||||
// public async Task Novel([Leftover] string query)
|
||||
@@ -38,8 +38,7 @@ public partial class Searches
|
||||
// await ctx.Channel.EmbedAsync(embed);
|
||||
// }
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[NadekoCommand, Aliases]
|
||||
[Priority(0)]
|
||||
public async Task Mal([Leftover] string name)
|
||||
{
|
||||
@@ -130,16 +129,14 @@ public partial class Searches
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task Mal(IGuildUser usr)
|
||||
public partial Task Mal(IGuildUser usr)
|
||||
=> Mal(usr.Username);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Anime([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Anime([Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
@@ -169,10 +166,9 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Manga([Leftover] string query)
|
||||
public async partial Task Manga([Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
|
@@ -5,11 +5,10 @@ namespace NadekoBot.Modules.Searches;
|
||||
|
||||
public partial class Searches
|
||||
{
|
||||
public class CryptoCommands : NadekoSubmodule<CryptoService>
|
||||
public partial class CryptoCommands : NadekoSubmodule<CryptoService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Crypto(string name)
|
||||
[Cmd]
|
||||
public async partial Task Crypto(string name)
|
||||
{
|
||||
name = name?.ToUpperInvariant();
|
||||
|
||||
|
@@ -8,16 +8,15 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class FeedCommands : NadekoSubmodule<FeedsService>
|
||||
public partial class FeedCommands : NadekoSubmodule<FeedsService>
|
||||
{
|
||||
private static readonly Regex YtChannelRegex =
|
||||
new(@"youtube\.com\/(?:c\/|channel\/|user\/)?(?<channelid>[a-zA-Z0-9\-]{1,})");
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null)
|
||||
public partial Task YtUploadNotif(string url, [Leftover] ITextChannel channel = null)
|
||||
{
|
||||
var m = YtChannelRegex.Match(url);
|
||||
if (!m.Success) return ReplyErrorLocalizedAsync(strs.invalid_input);
|
||||
@@ -27,11 +26,10 @@ public partial class Searches
|
||||
return Feed("https://www.youtube.com/feeds/videos.xml?channel_id=" + channelId, channel);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task Feed(string url, [Leftover] ITextChannel channel = null)
|
||||
public async partial Task Feed(string url, [Leftover] ITextChannel channel = null)
|
||||
{
|
||||
var success = Uri.TryCreate(url, UriKind.Absolute, out var uri)
|
||||
&& (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps);
|
||||
@@ -62,11 +60,10 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.feed_not_valid);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task FeedRemove(int index)
|
||||
public async partial Task FeedRemove(int index)
|
||||
{
|
||||
if (_service.RemoveFeed(ctx.Guild.Id, --index))
|
||||
await ReplyConfirmLocalizedAsync(strs.feed_removed);
|
||||
@@ -74,11 +71,10 @@ public partial class Searches
|
||||
await ReplyErrorLocalizedAsync(strs.feed_out_of_range);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task FeedList()
|
||||
public async partial Task FeedList()
|
||||
{
|
||||
var feeds = _service.GetFeeds(ctx.Guild.Id);
|
||||
|
||||
|
@@ -6,29 +6,25 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class JokeCommands : NadekoSubmodule<SearchesService>
|
||||
public partial class JokeCommands : NadekoSubmodule<SearchesService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Yomama()
|
||||
[Cmd]
|
||||
public async partial Task Yomama()
|
||||
=> await SendConfirmAsync(await _service.GetYomamaJoke());
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Randjoke()
|
||||
[Cmd]
|
||||
public async partial Task Randjoke()
|
||||
{
|
||||
var (setup, punchline) = await _service.GetRandomJoke();
|
||||
await SendConfirmAsync(setup, punchline);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ChuckNorris()
|
||||
[Cmd]
|
||||
public async partial Task ChuckNorris()
|
||||
=> await SendConfirmAsync(await _service.GetChuckNorrisJoke());
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task WowJoke()
|
||||
[Cmd]
|
||||
public async partial Task WowJoke()
|
||||
{
|
||||
if (!_service.WowJokes.Any())
|
||||
{
|
||||
@@ -40,9 +36,8 @@ public partial class Searches
|
||||
await SendConfirmAsync(joke.Question, joke.Answer);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task MagicItem()
|
||||
[Cmd]
|
||||
public async partial Task MagicItem()
|
||||
{
|
||||
if (!_service.WowJokes.Any())
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class MemegenCommands : NadekoSubmodule
|
||||
public partial class MemegenCommands : NadekoSubmodule
|
||||
{
|
||||
private static readonly ImmutableDictionary<char, string> _map = new Dictionary<char, string>
|
||||
{
|
||||
@@ -27,9 +27,8 @@ public partial class Searches
|
||||
public MemegenCommands(IHttpClientFactory factory)
|
||||
=> _httpFactory = factory;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Memelist(int page = 1)
|
||||
[Cmd]
|
||||
public async partial Task Memelist(int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -55,9 +54,8 @@ public partial class Searches
|
||||
15);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Memegen(string meme, [Leftover] string memeText = null)
|
||||
[Cmd]
|
||||
public async partial Task Memegen(string meme, [Leftover] string memeText = null)
|
||||
{
|
||||
var memeUrl = $"http://api.memegen.link/{meme}";
|
||||
if (!string.IsNullOrWhiteSpace(memeText))
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class OsuCommands : NadekoSubmodule
|
||||
public partial class OsuCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly IBotCredentials _creds;
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
@@ -18,9 +18,8 @@ public partial class Searches
|
||||
_httpFactory = factory;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Osu(string user, [Leftover] string mode = null)
|
||||
[Cmd]
|
||||
public async partial Task Osu(string user, [Leftover] string mode = null)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(user))
|
||||
return;
|
||||
@@ -75,9 +74,8 @@ public partial class Searches
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Gatari(string user, [Leftover] string mode = null)
|
||||
[Cmd]
|
||||
public async partial Task Gatari(string user, [Leftover] string mode = null)
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var modeNumber = string.IsNullOrWhiteSpace(mode) ? 0 : ResolveGameMode(mode);
|
||||
@@ -114,9 +112,8 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Osu5(string user, [Leftover] string mode = null)
|
||||
[Cmd]
|
||||
public async partial Task Osu5(string user, [Leftover] string mode = null)
|
||||
{
|
||||
;
|
||||
if (string.IsNullOrWhiteSpace(_creds.OsuApiKey))
|
||||
|
@@ -12,7 +12,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class PathOfExileCommands : NadekoSubmodule<SearchesService>
|
||||
public partial class PathOfExileCommands : NadekoSubmodule<SearchesService>
|
||||
{
|
||||
private const string _poeURL = "https://www.pathofexile.com/character-window/get-characters?accountName=";
|
||||
private const string _ponURL = "http://poe.ninja/api/Data/GetCurrencyOverview?league=";
|
||||
@@ -114,9 +114,8 @@ public partial class Searches
|
||||
public PathOfExileCommands(IHttpClientFactory httpFactory)
|
||||
=> _httpFactory = httpFactory;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PathOfExile(string usr, string league = "", int page = 1)
|
||||
[Cmd]
|
||||
public async partial Task PathOfExile(string usr, string league = "", int page = 1)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -177,9 +176,8 @@ public partial class Searches
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PathOfExileLeagues()
|
||||
[Cmd]
|
||||
public async partial Task PathOfExileLeagues()
|
||||
{
|
||||
var leagues = new List<Leagues>();
|
||||
|
||||
@@ -219,9 +217,8 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PathOfExileCurrency(string leagueName, string currencyName, string convertName = "Chaos Orb")
|
||||
[Cmd]
|
||||
public async partial Task PathOfExileCurrency(string leagueName, string currencyName, string convertName = "Chaos Orb")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(leagueName))
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class PlaceCommands : NadekoSubmodule
|
||||
public partial class PlaceCommands : NadekoSubmodule
|
||||
{
|
||||
public enum PlaceType
|
||||
{
|
||||
@@ -20,14 +20,12 @@ public partial class Searches
|
||||
|
||||
private static readonly string _typesStr = string.Join(", ", Enum.GetNames(typeof(PlaceType)));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Placelist()
|
||||
[Cmd]
|
||||
public async partial Task Placelist()
|
||||
=> await SendConfirmAsync(GetText(strs.list_of_place_tags(Prefix)), _typesStr);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Place(PlaceType placeType, uint width = 0, uint height = 0)
|
||||
[Cmd]
|
||||
public async partial Task Place(PlaceType placeType, uint width = 0, uint height = 0)
|
||||
{
|
||||
var url = string.Empty;
|
||||
switch (placeType)
|
||||
|
@@ -7,7 +7,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class PokemonSearchCommands : NadekoSubmodule<SearchesService>
|
||||
public partial class PokemonSearchCommands : NadekoSubmodule<SearchesService>
|
||||
{
|
||||
public IReadOnlyDictionary<string, SearchPokemon> Pokemons
|
||||
=> _cache.LocalData.Pokemons;
|
||||
@@ -20,9 +20,8 @@ public partial class Searches
|
||||
public PokemonSearchCommands(IDataCache cache)
|
||||
=> _cache = cache;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Pokemon([Leftover] string pokemon = null)
|
||||
[Cmd]
|
||||
public async partial Task Pokemon([Leftover] string pokemon = null)
|
||||
{
|
||||
pokemon = pokemon?.Trim().ToUpperInvariant();
|
||||
if (string.IsNullOrWhiteSpace(pokemon))
|
||||
@@ -51,9 +50,8 @@ public partial class Searches
|
||||
await ReplyErrorLocalizedAsync(strs.pokemon_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task PokemonAbility([Leftover] string ability = null)
|
||||
[Cmd]
|
||||
public async partial Task PokemonAbility([Leftover] string ability = null)
|
||||
{
|
||||
ability = ability?.Trim().ToUpperInvariant().Replace(" ", "", StringComparison.InvariantCulture);
|
||||
if (string.IsNullOrWhiteSpace(ability))
|
||||
|
@@ -40,9 +40,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
_tzSvc = tzSvc;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Rip([Leftover] IGuildUser usr)
|
||||
[Cmd]
|
||||
public async partial Task Rip([Leftover] IGuildUser usr)
|
||||
{
|
||||
var av = usr.RealAvatarUrl();
|
||||
if (av is null)
|
||||
@@ -53,9 +52,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
$"Rip {Format.Bold(usr.ToString())} \n\t- " + Format.Italics(ctx.User.ToString()));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Weather([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Weather([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -104,9 +102,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Time([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Time([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -153,9 +150,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync(embed: eb.Build());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Youtube([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Youtube([Leftover] string query = null)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -170,9 +166,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync(result);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Movie([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Movie([Leftover] string query = null)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -197,24 +192,20 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
.WithImageUrl(movie.Poster));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomCat()
|
||||
[Cmd]
|
||||
public partial Task RandomCat()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Cats);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomDog()
|
||||
[Cmd]
|
||||
public partial Task RandomDog()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Dogs);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomFood()
|
||||
[Cmd]
|
||||
public partial Task RandomFood()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Food);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public Task RandomBird()
|
||||
[Cmd]
|
||||
public partial Task RandomBird()
|
||||
=> InternalRandomImage(SearchesService.ImageTag.Birds);
|
||||
|
||||
private Task InternalRandomImage(SearchesService.ImageTag tag)
|
||||
@@ -223,9 +214,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
return ctx.Channel.EmbedAsync(_eb.Create().WithOkColor().WithImageUrl(url));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Image([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Image([Leftover] string query = null)
|
||||
{
|
||||
var oterms = query?.Trim();
|
||||
if (!await ValidateQuery(query))
|
||||
@@ -277,9 +267,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Lmgtfy([Leftover] string ffs = null)
|
||||
[Cmd]
|
||||
public async partial Task Lmgtfy([Leftover] string ffs = null)
|
||||
{
|
||||
if (!await ValidateQuery(ffs))
|
||||
return;
|
||||
@@ -288,9 +277,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await SendConfirmAsync($"<{shortenedUrl}>");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Shorten([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Shorten([Leftover] string query)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -327,9 +315,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
.AddField(GetText(strs.short_url), $"<{shortLink}>"));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Google([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Google([Leftover] string query = null)
|
||||
{
|
||||
query = query?.Trim();
|
||||
if (!await ValidateQuery(query))
|
||||
@@ -360,9 +347,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task DuckDuckGo([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task DuckDuckGo([Leftover] string query = null)
|
||||
{
|
||||
query = query?.Trim();
|
||||
if (!await ValidateQuery(query))
|
||||
@@ -392,9 +378,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task MagicTheGathering([Leftover] string search)
|
||||
[Cmd]
|
||||
public async partial Task MagicTheGathering([Leftover] string search)
|
||||
{
|
||||
if (!await ValidateQuery(search))
|
||||
return;
|
||||
@@ -420,9 +405,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Hearthstone([Leftover] string name)
|
||||
[Cmd]
|
||||
public async partial Task Hearthstone([Leftover] string name)
|
||||
{
|
||||
var arg = name;
|
||||
if (!await ValidateQuery(name))
|
||||
@@ -451,9 +435,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task UrbanDict([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task UrbanDict([Leftover] string query = null)
|
||||
{
|
||||
if (!await ValidateQuery(query))
|
||||
return;
|
||||
@@ -491,9 +474,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ReplyErrorLocalizedAsync(strs.ud_error);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Define([Leftover] string word)
|
||||
[Cmd]
|
||||
public async partial Task Define([Leftover] string word)
|
||||
{
|
||||
if (!await ValidateQuery(word))
|
||||
return;
|
||||
@@ -562,9 +544,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Catfact()
|
||||
[Cmd]
|
||||
public async partial Task Catfact()
|
||||
{
|
||||
using var http = _httpFactory.CreateClient();
|
||||
var response = await http.GetStringAsync("https://catfact.ninja/fact");
|
||||
@@ -576,10 +557,9 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
//done in 3.0
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Revav([Leftover] IGuildUser usr = null)
|
||||
public async partial Task Revav([Leftover] IGuildUser usr = null)
|
||||
{
|
||||
if (usr is null)
|
||||
usr = (IGuildUser)ctx.User;
|
||||
@@ -592,9 +572,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
|
||||
//done in 3.0
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Revimg([Leftover] string imageLink = null)
|
||||
[Cmd]
|
||||
public async partial Task Revimg([Leftover] string imageLink = null)
|
||||
{
|
||||
imageLink = imageLink?.Trim() ?? "";
|
||||
|
||||
@@ -603,9 +582,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await SendConfirmAsync($"https://images.google.com/searchbyimage?image_url={imageLink}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Wiki([Leftover] string query = null)
|
||||
[Cmd]
|
||||
public async partial Task Wiki([Leftover] string query = null)
|
||||
{
|
||||
query = query?.Trim();
|
||||
|
||||
@@ -623,9 +601,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync(data.Query.Pages[0].FullUrl);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Color(params Color[] colors)
|
||||
[Cmd]
|
||||
public async partial Task Color(params Color[] colors)
|
||||
{
|
||||
if (!colors.Any())
|
||||
return;
|
||||
@@ -643,10 +620,9 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendFileAsync(ms, "colors.png");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Avatar([Leftover] IGuildUser usr = null)
|
||||
public async partial Task Avatar([Leftover] IGuildUser usr = null)
|
||||
{
|
||||
if (usr is null)
|
||||
usr = (IGuildUser)ctx.User;
|
||||
@@ -668,9 +644,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
ctx.User.Mention);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Wikia(string target, [Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Wikia(string target, [Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(target) || string.IsNullOrWhiteSpace(query))
|
||||
{
|
||||
@@ -709,10 +684,9 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Bible(string book, string chapterAndVerse)
|
||||
public async partial Task Bible(string book, string chapterAndVerse)
|
||||
{
|
||||
var obj = new BibleVerses();
|
||||
try
|
||||
@@ -740,9 +714,8 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Steam([Leftover] string query)
|
||||
[Cmd]
|
||||
public async partial Task Steam([Leftover] string query)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(query))
|
||||
return;
|
||||
@@ -769,7 +742,7 @@ public partial class Searches : NadekoModule<SearchesService>
|
||||
await ctx.Channel.SendMessageAsync($"https://store.steampowered.com/app/{appId}");
|
||||
}
|
||||
|
||||
public async Task<bool> ValidateQuery(string query)
|
||||
private async Task<bool> ValidateQuery(string query)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(query)) return true;
|
||||
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class StreamNotificationCommands : NadekoSubmodule<StreamNotificationService>
|
||||
public partial class StreamNotificationCommands : NadekoSubmodule<StreamNotificationService>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
|
||||
@@ -19,11 +19,10 @@ public partial class Searches
|
||||
// private static readonly Regex picartoRegex = new Regex(@"picarto.tv/(?<name>.+[^/])/?",
|
||||
// RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamAdd(string link)
|
||||
public async partial Task StreamAdd(string link)
|
||||
{
|
||||
var data = await _service.FollowStream(ctx.Guild.Id, ctx.Channel.Id, link);
|
||||
if (data is null)
|
||||
@@ -36,12 +35,11 @@ public partial class Searches
|
||||
await ctx.Channel.EmbedAsync(embed, GetText(strs.stream_tracked));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task StreamRemove(int index)
|
||||
public async partial Task StreamRemove(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -56,20 +54,18 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_removed(Format.Bold(fs.Username), fs.Type));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task StreamsClear()
|
||||
public async partial Task StreamsClear()
|
||||
{
|
||||
var count = _service.ClearAllStreams(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.streams_cleared);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamList(int page = 1)
|
||||
public async partial Task StreamList(int page = 1)
|
||||
{
|
||||
if (page-- < 1) return;
|
||||
|
||||
@@ -113,11 +109,10 @@ public partial class Searches
|
||||
12);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamOffline()
|
||||
public async partial Task StreamOffline()
|
||||
{
|
||||
var newValue = _service.ToggleStreamOffline(ctx.Guild.Id);
|
||||
if (newValue)
|
||||
@@ -126,11 +121,10 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_off_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamMessage(int index, [Leftover] string message)
|
||||
public async partial Task StreamMessage(int index, [Leftover] string message)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -147,11 +141,10 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_message_set(Format.Bold(fs.Username)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task StreamMessageAll([Leftover] string message)
|
||||
public async partial Task StreamMessageAll([Leftover] string message)
|
||||
{
|
||||
var count = _service.SetStreamMessageForAll(ctx.Guild.Id, message);
|
||||
|
||||
@@ -164,10 +157,9 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_message_set_all(count));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamCheck(string url)
|
||||
public async partial Task StreamCheck(string url)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@@ -4,7 +4,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class TranslateCommands : NadekoSubmodule<ITranslateService>
|
||||
public partial class TranslateCommands : NadekoSubmodule<ITranslateService>
|
||||
{
|
||||
public enum AutoDeleteAutoTranslate
|
||||
{
|
||||
@@ -12,9 +12,8 @@ public partial class Searches
|
||||
Nodel
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Translate(string from, string to, [Leftover] string text = null)
|
||||
[Cmd]
|
||||
public async partial Task Translate(string from, string to, [Leftover] string text = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -31,13 +30,12 @@ public partial class Searches
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[BotPerm(ChannelPerm.ManageMessages)]
|
||||
[OwnerOnly]
|
||||
public async Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
|
||||
public async partial Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
|
||||
{
|
||||
var toggle =
|
||||
await _service.ToggleAtl(ctx.Guild.Id, ctx.Channel.Id, autoDelete == AutoDeleteAutoTranslate.Del);
|
||||
@@ -47,19 +45,17 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.atl_stopped);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AutoTransLang()
|
||||
public async partial Task AutoTransLang()
|
||||
{
|
||||
if (await _service.UnregisterUser(ctx.Channel.Id, ctx.User.Id))
|
||||
await ReplyConfirmLocalizedAsync(strs.atl_removed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AutoTransLang(string from, string to)
|
||||
public async partial Task AutoTransLang(string from, string to)
|
||||
{
|
||||
var succ = await _service.RegisterUserAsync(ctx.User.Id, ctx.Channel.Id, from.ToLower(), to.ToLower());
|
||||
|
||||
@@ -78,10 +74,9 @@ public partial class Searches
|
||||
await ReplyConfirmLocalizedAsync(strs.atl_set(from, to));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Translangs()
|
||||
public async partial Task Translangs()
|
||||
=> await ctx.Channel.SendTableAsync(_service.GetLanguages(), str => $"{str,-15}");
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
[Group]
|
||||
public class XkcdCommands : NadekoSubmodule
|
||||
public partial class XkcdCommands : NadekoSubmodule
|
||||
{
|
||||
private const string _xkcdUrl = "https://xkcd.com";
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
@@ -14,10 +14,9 @@ public partial class Searches
|
||||
public XkcdCommands(IHttpClientFactory factory)
|
||||
=> _httpFactory = factory;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Xkcd(string arg = null)
|
||||
public async partial Task Xkcd(string arg = null)
|
||||
{
|
||||
if (arg?.ToLowerInvariant().Trim() == "latest")
|
||||
{
|
||||
@@ -49,10 +48,9 @@ public partial class Searches
|
||||
await Xkcd(new NadekoRandom().Next(1, 1750));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Xkcd(int num)
|
||||
public async partial Task Xkcd(int num)
|
||||
{
|
||||
if (num < 1)
|
||||
return;
|
||||
|
@@ -4,7 +4,7 @@ namespace NadekoBot.Modules.Searches;
|
||||
public partial class Searches
|
||||
{
|
||||
// [Group]
|
||||
// public class YtTrackCommands : NadekoSubmodule<YtTrackService>
|
||||
// public partial class YtTrackCommands : NadekoSubmodule<YtTrackService>
|
||||
// {
|
||||
// ;
|
||||
// [RequireContext(ContextType.Guild)]
|
||||
|
@@ -7,11 +7,10 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class CalcCommands : NadekoSubmodule
|
||||
public partial class CalcCommands : NadekoSubmodule
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task Calculate([Leftover] string expression)
|
||||
[Cmd]
|
||||
public async partial Task Calculate([Leftover] string expression)
|
||||
{
|
||||
var expr = new Expression(expression, EvaluateOptions.IgnoreCase | EvaluateOptions.NoCache);
|
||||
expr.EvaluateParameter += Expr_EvaluateParameter;
|
||||
@@ -35,9 +34,8 @@ public partial class Utility
|
||||
}
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task CalcOps()
|
||||
[Cmd]
|
||||
public async partial Task CalcOps()
|
||||
{
|
||||
var selection = typeof(Math).GetTypeInfo()
|
||||
.GetMethods()
|
||||
|
@@ -9,7 +9,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class CommandMapCommands : NadekoSubmodule<CommandMapService>
|
||||
public partial class CommandMapCommands : NadekoSubmodule<CommandMapService>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -20,21 +20,19 @@ public partial class Utility
|
||||
_client = client;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task AliasesClear()
|
||||
public async partial Task AliasesClear()
|
||||
{
|
||||
var count = _service.ClearAliases(ctx.Guild.Id);
|
||||
await ReplyConfirmLocalizedAsync(strs.aliases_cleared(count));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Alias(string trigger, [Leftover] string mapping = null)
|
||||
public async partial Task Alias(string trigger, [Leftover] string mapping = null)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
|
||||
@@ -101,10 +99,9 @@ public partial class Utility
|
||||
}
|
||||
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task AliasList(int page = 1)
|
||||
public async partial Task AliasList(int page = 1)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
page -= 1;
|
||||
|
@@ -3,17 +3,16 @@ namespace NadekoBot.Modules.Utility;
|
||||
|
||||
public partial class Utility
|
||||
{
|
||||
public class ConfigCommands : NadekoSubmodule
|
||||
public partial class ConfigCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly IEnumerable<IConfigService> _settingServices;
|
||||
|
||||
public ConfigCommands(IEnumerable<IConfigService> settingServices)
|
||||
=> _settingServices = settingServices;
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task ConfigReload(string name)
|
||||
public async partial Task ConfigReload(string name)
|
||||
{
|
||||
var setting = _settingServices.FirstOrDefault(x
|
||||
=> x.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase));
|
||||
@@ -34,10 +33,9 @@ public partial class Utility
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[OwnerOnly]
|
||||
public async Task Config(string name = null, string prop = null, [Leftover] string value = null)
|
||||
public async partial Task Config(string name = null, string prop = null, [Leftover] string value = null)
|
||||
{
|
||||
var configNames = _settingServices.Select(x => x.Name);
|
||||
|
||||
|
@@ -6,7 +6,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class InfoCommands : NadekoSubmodule
|
||||
public partial class InfoCommands : NadekoSubmodule
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
private readonly IStatsService _stats;
|
||||
@@ -17,10 +17,9 @@ public partial class Utility
|
||||
_stats = stats;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ServerInfo(string guildName = null)
|
||||
public async partial Task ServerInfo(string guildName = null)
|
||||
{
|
||||
var channel = (ITextChannel)ctx.Channel;
|
||||
guildName = guildName?.ToUpperInvariant();
|
||||
@@ -65,10 +64,9 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task ChannelInfo(ITextChannel channel = null)
|
||||
public async partial Task ChannelInfo(ITextChannel channel = null)
|
||||
{
|
||||
var ch = channel ?? (ITextChannel)ctx.Channel;
|
||||
if (ch is null)
|
||||
@@ -85,10 +83,9 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task UserInfo(IGuildUser usr = null)
|
||||
public async partial Task UserInfo(IGuildUser usr = null)
|
||||
{
|
||||
var user = usr ?? ctx.User as IGuildUser;
|
||||
|
||||
@@ -111,11 +108,10 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[OwnerOnly]
|
||||
public async Task Activity(int page = 1)
|
||||
public async partial Task Activity(int page = 1)
|
||||
{
|
||||
const int activityPerPage = 10;
|
||||
page -= 1;
|
||||
|
@@ -6,15 +6,14 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class InviteCommands : NadekoSubmodule<InviteService>
|
||||
public partial class InviteCommands : NadekoSubmodule<InviteService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(ChannelPerm.CreateInstantInvite)]
|
||||
[UserPerm(ChannelPerm.CreateInstantInvite)]
|
||||
[NadekoOptions(typeof(InviteService.Options))]
|
||||
public async Task InviteCreate(params string[] args)
|
||||
public async partial Task InviteCreate(params string[] args)
|
||||
{
|
||||
var (opts, success) = OptionsParser.ParseFrom(new InviteService.Options(), args);
|
||||
if (!success)
|
||||
@@ -26,12 +25,11 @@ public partial class Utility
|
||||
await SendConfirmAsync($"{ctx.User.Mention} https://discord.gg/{invite.Code}");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(ChannelPerm.ManageChannels)]
|
||||
[UserPerm(ChannelPerm.ManageChannels)]
|
||||
public async Task InviteList(int page = 1, [Leftover] ITextChannel ch = null)
|
||||
public async partial Task InviteList(int page = 1, [Leftover] ITextChannel ch = null)
|
||||
{
|
||||
if (--page < 0)
|
||||
return;
|
||||
@@ -71,12 +69,11 @@ public partial class Utility
|
||||
9);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[BotPerm(ChannelPerm.ManageChannels)]
|
||||
[UserPerm(ChannelPerm.ManageChannels)]
|
||||
public async Task InviteDelete(int index)
|
||||
public async partial Task InviteDelete(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
|
@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class QuoteCommands : NadekoSubmodule
|
||||
public partial class QuoteCommands : NadekoSubmodule
|
||||
{
|
||||
private const string _prependExport =
|
||||
@"# Keys are keywords, Each key has a LIST of quotes in the following format:
|
||||
@@ -40,18 +40,16 @@ public partial class Utility
|
||||
_http = http;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(1)]
|
||||
public Task ListQuotes(OrderType order = OrderType.Keyword)
|
||||
public partial Task ListQuotes(OrderType order = OrderType.Keyword)
|
||||
=> ListQuotes(1, order);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[Priority(0)]
|
||||
public async Task ListQuotes(int page = 1, OrderType order = OrderType.Keyword)
|
||||
public async partial Task ListQuotes(int page = 1, OrderType order = OrderType.Keyword)
|
||||
{
|
||||
page -= 1;
|
||||
if (page < 0)
|
||||
@@ -72,10 +70,9 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.quotes_page_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuotePrint([Leftover] string keyword)
|
||||
public async partial Task QuotePrint([Leftover] string keyword)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword))
|
||||
return;
|
||||
@@ -104,10 +101,9 @@ public partial class Utility
|
||||
await ctx.Channel.SendAsync($"`#{quote.Id}` 📣 " + text, true);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteShow(int id)
|
||||
public async partial Task QuoteShow(int id)
|
||||
{
|
||||
Quote quote;
|
||||
await using (var uow = _db.GetDbContext())
|
||||
@@ -136,10 +132,9 @@ public partial class Utility
|
||||
.WithFooter(
|
||||
GetText(strs.created_by($"{data.AuthorName} ({data.AuthorId})"))));
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteSearch(string keyword, [Leftover] string text)
|
||||
public async partial Task QuoteSearch(string keyword, [Leftover] string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
@@ -161,10 +156,9 @@ public partial class Utility
|
||||
+ keywordquote.Text.SanitizeAllMentions());
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteId(int id)
|
||||
public async partial Task QuoteId(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
return;
|
||||
@@ -194,10 +188,9 @@ public partial class Utility
|
||||
await ctx.Channel.SendAsync(infoText + text, true);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteAdd(string keyword, [Leftover] string text)
|
||||
public async partial Task QuoteAdd(string keyword, [Leftover] string text)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword) || string.IsNullOrWhiteSpace(text))
|
||||
return;
|
||||
@@ -221,10 +214,9 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.quote_added_new(Format.Code(q.Id.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task QuoteDelete(int id)
|
||||
public async partial Task QuoteDelete(int id)
|
||||
{
|
||||
var hasManageMessages = ((IGuildUser)ctx.Message.Author).GuildPermissions.ManageMessages;
|
||||
|
||||
@@ -253,11 +245,10 @@ public partial class Utility
|
||||
await SendErrorAsync(response);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task DelAllQuotes([Leftover] string keyword)
|
||||
public async partial Task DelAllQuotes([Leftover] string keyword)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(keyword))
|
||||
return;
|
||||
@@ -274,11 +265,10 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.quotes_deleted(Format.Bold(keyword.SanitizeAllMentions())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
public async Task QuotesExport()
|
||||
public async partial Task QuotesExport()
|
||||
{
|
||||
IEnumerable<Quote> quotes;
|
||||
await using (var uow = _db.GetDbContext())
|
||||
@@ -295,15 +285,14 @@ public partial class Utility
|
||||
await ctx.Channel.SendFileAsync(stream, "quote-export.yml");
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Ratelimit(300)]
|
||||
#if GLOBAL_NADEKO
|
||||
[OwnerOnly]
|
||||
#endif
|
||||
public async Task QuotesImport([Leftover] string input = null)
|
||||
public async partial Task QuotesImport([Leftover] string input = null)
|
||||
{
|
||||
input = input?.Trim();
|
||||
|
||||
@@ -338,7 +327,7 @@ public partial class Utility
|
||||
await ctx.OkAsync();
|
||||
}
|
||||
|
||||
public async Task<bool> ImportCrsAsync(ulong guildId, string input)
|
||||
private async Task<bool> ImportCrsAsync(ulong guildId, string input)
|
||||
{
|
||||
Dictionary<string, List<ExportedQuote>> data;
|
||||
try
|
||||
|
@@ -10,7 +10,7 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class RemindCommands : NadekoSubmodule<RemindService>
|
||||
public partial class RemindCommands : NadekoSubmodule<RemindService>
|
||||
{
|
||||
public enum MeOrHere
|
||||
{
|
||||
@@ -35,10 +35,9 @@ public partial class Utility
|
||||
_tz = tz;
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public async Task Remind(MeOrHere meorhere, [Leftover] string remindString)
|
||||
public async partial Task Remind(MeOrHere meorhere, [Leftover] string remindString)
|
||||
{
|
||||
if (!_service.TryParseRemindMessage(remindString, out var remindData))
|
||||
{
|
||||
@@ -54,12 +53,11 @@ public partial class Utility
|
||||
remindData.What)) await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public async Task Remind(ITextChannel channel, [Leftover] string remindString)
|
||||
public async partial Task Remind(ITextChannel channel, [Leftover] string remindString)
|
||||
{
|
||||
var perms = ((IGuildUser)ctx.User).GetPermissions(channel);
|
||||
if (!perms.SendMessages || !perms.ViewChannel)
|
||||
@@ -79,18 +77,16 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.remind_too_long);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public Task RemindList(Server _, int page = 1)
|
||||
public partial Task RemindList(Server _, int page = 1)
|
||||
=> RemindListInternal(page, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public Task RemindList(int page = 1)
|
||||
public partial Task RemindList(int page = 1)
|
||||
=> RemindListInternal(page, false);
|
||||
|
||||
private async Task RemindListInternal(int page, bool isServer)
|
||||
@@ -135,18 +131,16 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.Administrator)]
|
||||
[Priority(0)]
|
||||
public Task RemindDelete(Server _, int index)
|
||||
public partial Task RemindDelete(Server _, int index)
|
||||
=> RemindDelete(index, true);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(1)]
|
||||
public Task RemindDelete(int index)
|
||||
public partial Task RemindDelete(int index)
|
||||
=> RemindDelete(index, false);
|
||||
|
||||
private async Task RemindDelete(int index, bool isServer)
|
||||
|
@@ -7,13 +7,12 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class RepeatCommands : NadekoSubmodule<RepeaterService>
|
||||
public partial class RepeatCommands : NadekoSubmodule<RepeaterService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatInvoke(int index)
|
||||
public async partial Task RepeatInvoke(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -22,11 +21,10 @@ public partial class Utility
|
||||
if (!success) await ReplyErrorLocalizedAsync(strs.repeat_invoke_none);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatRemove(int index)
|
||||
public async partial Task RepeatRemove(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -45,11 +43,10 @@ public partial class Utility
|
||||
.WithDescription(description));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatRedundant(int index)
|
||||
public async partial Task RepeatRedundant(int index)
|
||||
{
|
||||
if (--index < 0)
|
||||
return;
|
||||
@@ -68,36 +65,32 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.repeater_redundant_yes(index + 1));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(-1)]
|
||||
public Task Repeat([Leftover] string message)
|
||||
public partial Task Repeat([Leftover] string message)
|
||||
=> Repeat(null, null, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(0)]
|
||||
public Task Repeat(StoopidTime interval, [Leftover] string message)
|
||||
public partial Task Repeat(StoopidTime interval, [Leftover] string message)
|
||||
=> Repeat(null, interval, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public Task Repeat(GuildDateTime dt, [Leftover] string message)
|
||||
public partial Task Repeat(GuildDateTime dt, [Leftover] string message)
|
||||
=> Repeat(dt, null, message);
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
[Priority(2)]
|
||||
public async Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
|
||||
public async partial Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
|
||||
{
|
||||
var startTimeOfDay = dt?.InputTimeUtc.TimeOfDay;
|
||||
// if interval not null, that means user specified it (don't change it)
|
||||
@@ -137,11 +130,10 @@ public partial class Utility
|
||||
.WithDescription(description));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[UserPerm(GuildPerm.ManageMessages)]
|
||||
public async Task RepeatList()
|
||||
public async partial Task RepeatList()
|
||||
{
|
||||
var repeaters = _service.GetRepeaters(ctx.Guild.Id);
|
||||
if (repeaters.Count == 0)
|
||||
|
@@ -6,14 +6,13 @@ namespace NadekoBot.Modules.Utility;
|
||||
|
||||
public partial class Utility
|
||||
{
|
||||
public class StreamRoleCommands : NadekoSubmodule<StreamRoleService>
|
||||
public partial class StreamRoleCommands : NadekoSubmodule<StreamRoleService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRole(IRole fromRole, IRole addRole)
|
||||
public async partial Task StreamRole(IRole fromRole, IRole addRole)
|
||||
{
|
||||
await _service.SetStreamRole(fromRole, addRole);
|
||||
|
||||
@@ -21,23 +20,21 @@ public partial class Utility
|
||||
Format.Bold(addRole.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRole()
|
||||
public async partial Task StreamRole()
|
||||
{
|
||||
await _service.StopStreamRole(ctx.Guild);
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_disabled);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleKeyword([Leftover] string keyword = null)
|
||||
public async partial Task StreamRoleKeyword([Leftover] string keyword = null)
|
||||
{
|
||||
var kw = await _service.SetKeyword(ctx.Guild, keyword);
|
||||
|
||||
@@ -47,12 +44,11 @@ public partial class Utility
|
||||
await ReplyConfirmLocalizedAsync(strs.stream_role_kw_set(Format.Bold(kw)));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user)
|
||||
public async partial Task StreamRoleBlacklist(AddRemove action, [Leftover] IGuildUser user)
|
||||
{
|
||||
var success = await _service.ApplyListAction(StreamRoleListType.Blacklist,
|
||||
ctx.Guild,
|
||||
@@ -71,12 +67,11 @@ public partial class Utility
|
||||
await ReplyErrorLocalizedAsync(strs.stream_role_bl_rem_fail(Format.Bold(user.ToString())));
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[BotPerm(GuildPerm.ManageRoles)]
|
||||
[UserPerm(GuildPerm.ManageRoles)]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user)
|
||||
public async partial Task StreamRoleWhitelist(AddRemove action, [Leftover] IGuildUser user)
|
||||
{
|
||||
var success = await _service.ApplyListAction(StreamRoleListType.Whitelist,
|
||||
ctx.Guild,
|
||||
|
@@ -6,11 +6,10 @@ namespace NadekoBot.Modules.Utility;
|
||||
public partial class Utility
|
||||
{
|
||||
[Group]
|
||||
public class UnitConverterCommands : NadekoSubmodule<ConverterService>
|
||||
public partial class UnitConverterCommands : NadekoSubmodule<ConverterService>
|
||||
{
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
public async Task ConvertList()
|
||||
[Cmd]
|
||||
public async partial Task ConvertList()
|
||||
{
|
||||
var units = _service.Units;
|
||||
|
||||
@@ -24,10 +23,9 @@ public partial class Utility
|
||||
await ctx.Channel.EmbedAsync(embed);
|
||||
}
|
||||
|
||||
[NadekoCommand]
|
||||
[Aliases]
|
||||
[Cmd]
|
||||
[Priority(0)]
|
||||
public async Task Convert(string origin, string target, decimal value)
|
||||
public async partial Task Convert(string origin, string target, decimal value)
|
||||
{
|
||||
var originUnit = _service.Units.FirstOrDefault(x
|
||||
=> x.Triggers.Select(y => y.ToUpperInvariant()).Contains(origin.ToUpperInvariant()));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user