mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Removed some obsolete commands and strings
This commit is contained in:
@@ -7,6 +7,8 @@ using NadekoBot.Common.ModuleBehaviors;
|
|||||||
using NadekoBot.Common.Configs;
|
using NadekoBot.Common.Configs;
|
||||||
using NadekoBot.Db;
|
using NadekoBot.Db;
|
||||||
using NadekoBot.Modules.Administration.Services;
|
using NadekoBot.Modules.Administration.Services;
|
||||||
|
using Discord.Interactions;
|
||||||
|
using RunMode = Discord.Interactions.RunMode;
|
||||||
|
|
||||||
namespace NadekoBot;
|
namespace NadekoBot;
|
||||||
|
|
||||||
@@ -16,6 +18,7 @@ public sealed class Bot
|
|||||||
private readonly CommandService _commandService;
|
private readonly CommandService _commandService;
|
||||||
private readonly DbService _db;
|
private readonly DbService _db;
|
||||||
private readonly IBotCredsProvider _credsProvider;
|
private readonly IBotCredsProvider _credsProvider;
|
||||||
|
private readonly InteractionService _interactionService;
|
||||||
|
|
||||||
public event Func<GuildConfig, Task> JoinedGuild = delegate { return Task.CompletedTask; };
|
public event Func<GuildConfig, Task> JoinedGuild = delegate { return Task.CompletedTask; };
|
||||||
|
|
||||||
@@ -57,9 +60,11 @@ public sealed class Bot
|
|||||||
_commandService = new(new()
|
_commandService = new(new()
|
||||||
{
|
{
|
||||||
CaseSensitiveCommands = false,
|
CaseSensitiveCommands = false,
|
||||||
DefaultRunMode = RunMode.Sync,
|
DefaultRunMode = Discord.Commands.RunMode.Sync,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
_interactionService = new(Client.Rest);
|
||||||
|
|
||||||
#if GLOBAL_NADEKO || DEBUG
|
#if GLOBAL_NADEKO || DEBUG
|
||||||
Client.Log += Client_Log;
|
Client.Log += Client_Log;
|
||||||
#endif
|
#endif
|
||||||
@@ -89,6 +94,7 @@ public sealed class Bot
|
|||||||
.AddRedis(_creds.RedisOptions) // redis
|
.AddRedis(_creds.RedisOptions) // redis
|
||||||
.AddSingleton(Client) // discord socket client
|
.AddSingleton(Client) // discord socket client
|
||||||
.AddSingleton(_commandService)
|
.AddSingleton(_commandService)
|
||||||
|
.AddSingleton(_interactionService)
|
||||||
.AddSingleton(this)
|
.AddSingleton(this)
|
||||||
.AddSingleton<ISeria, JsonSeria>()
|
.AddSingleton<ISeria, JsonSeria>()
|
||||||
.AddSingleton<IPubSub, RedisPubSub>()
|
.AddSingleton<IPubSub, RedisPubSub>()
|
||||||
@@ -308,7 +314,8 @@ public sealed class Bot
|
|||||||
await commandHandler.StartHandling().ConfigureAwait(false);
|
await commandHandler.StartHandling().ConfigureAwait(false);
|
||||||
|
|
||||||
await _commandService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
await _commandService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||||
|
await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services);
|
||||||
|
await _interactionService.RegisterCommandsToGuildAsync(117523346618318850);
|
||||||
IsReady = true;
|
IsReady = true;
|
||||||
_ = Task.Run(ExecuteReadySubscriptions);
|
_ = Task.Run(ExecuteReadySubscriptions);
|
||||||
Log.Information("Shard {ShardId} ready", Client.ShardId);
|
Log.Information("Shard {ShardId} ready", Client.ShardId);
|
||||||
|
@@ -14,10 +14,6 @@ public class FollowedStream : DbEntity
|
|||||||
public enum FType
|
public enum FType
|
||||||
{
|
{
|
||||||
Twitch = 0,
|
Twitch = 0,
|
||||||
[Obsolete("No longer supported.")]
|
|
||||||
Smashcast = 1,
|
|
||||||
[Obsolete("No longer supported.")]
|
|
||||||
Mixer = 2,
|
|
||||||
Picarto = 3,
|
Picarto = 3,
|
||||||
Youtube = 4,
|
Youtube = 4,
|
||||||
Facebook = 5,
|
Facebook = 5,
|
||||||
@@ -36,12 +32,7 @@ public class FollowedStream : DbEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
=> obj is FollowedStream fs && Equals(fs);
|
||||||
if (ReferenceEquals(null, obj)) return false;
|
|
||||||
if (ReferenceEquals(this, obj)) return true;
|
|
||||||
if (obj.GetType() != this.GetType()) return false;
|
|
||||||
return Equals((FollowedStream) obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StreamDataKey CreateKey() =>
|
public StreamDataKey CreateKey() =>
|
||||||
new StreamDataKey(Type, Username.ToLower());
|
new StreamDataKey(Type, Username.ToLower());
|
||||||
|
@@ -109,21 +109,6 @@ public class CustomReactions : NadekoModule<CustomReactionsService>
|
|||||||
All
|
All
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
|
||||||
[Priority(0)]
|
|
||||||
public async Task ListCustReact(All _)
|
|
||||||
{
|
|
||||||
await ReplyPendingLocalizedAsync(strs.obsolete_use(Format.Code($"{Prefix}crsexport")));
|
|
||||||
await CrsExport();
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
|
||||||
public async Task ListCustReactG(int page = 1)
|
|
||||||
{
|
|
||||||
await ReplyPendingLocalizedAsync(strs.obsolete_use(Format.Code($"{Prefix}crsexport")));
|
|
||||||
await CrsExport();
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
public async Task ShowCustReact(kwum id)
|
public async Task ShowCustReact(kwum id)
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,12 @@
|
|||||||
namespace NadekoBot.Modules.Gambling;
|
using Discord.Interactions;
|
||||||
|
|
||||||
public class TestGamblingService
|
namespace NadekoBot.Modules.Gambling;
|
||||||
|
|
||||||
|
public class TestGamblingService : InteractionModuleBase
|
||||||
{
|
{
|
||||||
|
[SlashCommand("test", "uwu")]
|
||||||
|
public async Task Test(string input1, int input2)
|
||||||
|
{
|
||||||
|
await RespondAsync("Bravo " + input1 + input2);
|
||||||
|
}
|
||||||
}
|
}
|
@@ -499,14 +499,6 @@ public sealed partial class Music : NadekoModule<IMusicService>
|
|||||||
await ReplyConfirmLocalizedAsync(strs.repeating_track);
|
await ReplyConfirmLocalizedAsync(strs.repeating_track);
|
||||||
}
|
}
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
|
||||||
[RequireContext(ContextType.Guild)]
|
|
||||||
public async Task ReptCurSong()
|
|
||||||
{
|
|
||||||
await ReplyPendingLocalizedAsync(strs.obsolete_use($"`{Prefix}qrp song`"));
|
|
||||||
await QueueRepeat(InputRepeatType.Song);
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
[NadekoCommand, Aliases]
|
||||||
[RequireContext(ContextType.Guild)]
|
[RequireContext(ContextType.Guild)]
|
||||||
public async Task Pause()
|
public async Task Pause()
|
||||||
|
@@ -1,45 +0,0 @@
|
|||||||
using NadekoBot.Modules.Utility.Services;
|
|
||||||
|
|
||||||
namespace NadekoBot.Modules.Utility;
|
|
||||||
|
|
||||||
public partial class Utility
|
|
||||||
{
|
|
||||||
[Group]
|
|
||||||
public class PatreonCommands : NadekoSubmodule<PatreonRewardsService>
|
|
||||||
{
|
|
||||||
private readonly IBotCredentials _creds;
|
|
||||||
|
|
||||||
public PatreonCommands(IBotCredentials creds)
|
|
||||||
{
|
|
||||||
_creds = creds;
|
|
||||||
}
|
|
||||||
|
|
||||||
[NadekoCommand, Aliases]
|
|
||||||
[RequireContext(ContextType.DM)]
|
|
||||||
public async Task ClaimPatreonRewards()
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(_creds.Patreon.AccessToken))
|
|
||||||
{
|
|
||||||
Log.Warning("In order to use patreon reward commands, " +
|
|
||||||
"you need to specify CampaignId and AccessToken in creds.yml");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DateTime.UtcNow.Day < 5)
|
|
||||||
{
|
|
||||||
await ReplyErrorLocalizedAsync(strs.clpa_too_early).ConfigureAwait(false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var rem = _service.Interval - (DateTime.UtcNow - _service.LastUpdate);
|
|
||||||
var helpcmd = Format.Code(Prefix + "donate");
|
|
||||||
await ctx.Channel.EmbedAsync(_eb.Create().WithOkColor()
|
|
||||||
.WithDescription(GetText(strs.clpa_obsolete))
|
|
||||||
.AddField(GetText(strs.clpa_fail_already_title), GetText(strs.clpa_fail_already))
|
|
||||||
.AddField(GetText(strs.clpa_fail_wait_title), GetText(strs.clpa_fail_wait))
|
|
||||||
.AddField(GetText(strs.clpa_fail_conn_title), GetText(strs.clpa_fail_conn))
|
|
||||||
.AddField(GetText(strs.clpa_fail_sup_title), GetText(strs.clpa_fail_sup(helpcmd)))
|
|
||||||
.WithFooter(GetText(strs.clpa_next_update(rem))));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using NadekoBot.Common.Configs;
|
using NadekoBot.Common.Configs;
|
||||||
using NadekoBot.Db;
|
using NadekoBot.Db;
|
||||||
|
using Discord.Interactions;
|
||||||
|
|
||||||
namespace NadekoBot.Services;
|
namespace NadekoBot.Services;
|
||||||
|
|
||||||
@@ -35,7 +36,8 @@ public class CommandHandler : INService
|
|||||||
BotConfigService bss,
|
BotConfigService bss,
|
||||||
Bot bot,
|
Bot bot,
|
||||||
IBehaviourExecutor behaviourExecutor,
|
IBehaviourExecutor behaviourExecutor,
|
||||||
IServiceProvider services)
|
IServiceProvider services,
|
||||||
|
InteractionService interactions)
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
_commandService = commandService;
|
_commandService = commandService;
|
||||||
@@ -44,6 +46,7 @@ public class CommandHandler : INService
|
|||||||
_behaviourExecutor = behaviourExecutor;
|
_behaviourExecutor = behaviourExecutor;
|
||||||
_db = db;
|
_db = db;
|
||||||
_services = services;
|
_services = services;
|
||||||
|
_interactions = interactions;
|
||||||
|
|
||||||
_clearUsersOnShortCooldown = new(_ =>
|
_clearUsersOnShortCooldown = new(_ =>
|
||||||
{
|
{
|
||||||
@@ -121,12 +124,20 @@ public class CommandHandler : INService
|
|||||||
|
|
||||||
public Task StartHandling()
|
public Task StartHandling()
|
||||||
{
|
{
|
||||||
_client.MessageReceived += msg => { var _ = Task.Run(() => MessageReceivedHandler(msg)); return Task.CompletedTask; };
|
_client.MessageReceived += MessageReceivedHandler;
|
||||||
|
_client.SlashCommandExecuted += SlashCommandExecuted;
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task SlashCommandExecuted(SocketSlashCommand arg)
|
||||||
|
{
|
||||||
|
var ctx = new SocketInteractionContext<SocketSlashCommand>(_client, arg);
|
||||||
|
await _interactions.ExecuteCommandAsync(ctx, _services);
|
||||||
|
}
|
||||||
|
|
||||||
private const float _oneThousandth = 1.0f / 1000;
|
private const float _oneThousandth = 1.0f / 1000;
|
||||||
private readonly DbService _db;
|
private readonly DbService _db;
|
||||||
|
private readonly InteractionService _interactions;
|
||||||
|
|
||||||
private Task LogSuccessfulExecution(IUserMessage usrMsg, ITextChannel channel, params int[] execPoints)
|
private Task LogSuccessfulExecution(IUserMessage usrMsg, ITextChannel channel, params int[] execPoints)
|
||||||
{
|
{
|
||||||
@@ -264,7 +275,7 @@ public class CommandHandler : INService
|
|||||||
return (false, null, null);
|
return (false, null, null);
|
||||||
|
|
||||||
var commands = searchResult.Commands;
|
var commands = searchResult.Commands;
|
||||||
var preconditionResults = new Dictionary<CommandMatch, PreconditionResult>();
|
var preconditionResults = new Dictionary<CommandMatch, Discord.Commands.PreconditionResult>();
|
||||||
|
|
||||||
foreach (var match in commands)
|
foreach (var match in commands)
|
||||||
{
|
{
|
||||||
@@ -352,7 +363,7 @@ public class CommandHandler : INService
|
|||||||
|
|
||||||
//If we get this far, at least one parse was successful. Execute the most likely overload.
|
//If we get this far, at least one parse was successful. Execute the most likely overload.
|
||||||
var chosenOverload = successfulParses[0];
|
var chosenOverload = successfulParses[0];
|
||||||
var execResult = (ExecuteResult)await chosenOverload.Key.ExecuteAsync(context, chosenOverload.Value, services).ConfigureAwait(false);
|
var execResult = (Discord.Commands.ExecuteResult)await chosenOverload.Key.ExecuteAsync(context, chosenOverload.Value, services).ConfigureAwait(false);
|
||||||
|
|
||||||
if (execResult.Exception != null && (!(execResult.Exception is HttpException he) || he.DiscordCode != DiscordErrorCode.InsufficientPermissions))
|
if (execResult.Exception != null && (!(execResult.Exception is HttpException he) || he.DiscordCode != DiscordErrorCode.InsufficientPermissions))
|
||||||
{
|
{
|
||||||
|
@@ -103,11 +103,6 @@ listcustreact:
|
|||||||
- lcr
|
- lcr
|
||||||
- exprli
|
- exprli
|
||||||
- exl
|
- exl
|
||||||
listcustreactg:
|
|
||||||
- listcustreactg
|
|
||||||
- lcrg
|
|
||||||
- exprlg
|
|
||||||
- exlg
|
|
||||||
showcustreact:
|
showcustreact:
|
||||||
- showcustreact
|
- showcustreact
|
||||||
- scr
|
- scr
|
||||||
@@ -503,9 +498,6 @@ trackremove:
|
|||||||
movesong:
|
movesong:
|
||||||
- movesong
|
- movesong
|
||||||
- ms
|
- ms
|
||||||
reptcursong:
|
|
||||||
- reptcursong
|
|
||||||
- rcs
|
|
||||||
queuerepeat:
|
queuerepeat:
|
||||||
- queuerepeat
|
- queuerepeat
|
||||||
- qrp
|
- qrp
|
||||||
@@ -989,9 +981,6 @@ warnpunishlist:
|
|||||||
warnpunish:
|
warnpunish:
|
||||||
- warnpunish
|
- warnpunish
|
||||||
- warnp
|
- warnp
|
||||||
claimpatreonrewards:
|
|
||||||
- clparew
|
|
||||||
- claparew
|
|
||||||
ping:
|
ping:
|
||||||
- ping
|
- ping
|
||||||
time:
|
time:
|
||||||
|
@@ -862,10 +862,6 @@ setmaxqueue:
|
|||||||
args:
|
args:
|
||||||
- "50"
|
- "50"
|
||||||
- ""
|
- ""
|
||||||
reptcursong:
|
|
||||||
desc: "Obsolete. Use `{0}queuerepeat`"
|
|
||||||
args:
|
|
||||||
- ""
|
|
||||||
queuerepeat:
|
queuerepeat:
|
||||||
desc: "Sets music player repeat strategy for this server.\n- `n` / `no` - player will stop once it reaches the end of the queue\n- `s` / `song` - player will repeat current song\n- `q` / `queue` or empty - player will repeat entire music queue"
|
desc: "Sets music player repeat strategy for this server.\n- `n` / `no` - player will stop once it reaches the end of the queue\n- `s` / `song` - player will repeat current song\n- `q` / `queue` or empty - player will repeat entire music queue"
|
||||||
args:
|
args:
|
||||||
@@ -1685,10 +1681,6 @@ warnpunish:
|
|||||||
- "5 Ban"
|
- "5 Ban"
|
||||||
- "5 Mute 2d12h"
|
- "5 Mute 2d12h"
|
||||||
- "4 AddRole toxic 1h"
|
- "4 AddRole toxic 1h"
|
||||||
clparew:
|
|
||||||
desc: "Claim patreon rewards. If you're subscribed to bot owner's patreon you can use this command to claim your rewards - assuming bot owner did setup has their patreon key."
|
|
||||||
args:
|
|
||||||
- ""
|
|
||||||
ping:
|
ping:
|
||||||
desc: "Ping the bot to see if there are latency issues."
|
desc: "Ping the bot to see if there are latency issues."
|
||||||
args:
|
args:
|
||||||
|
@@ -681,16 +681,6 @@
|
|||||||
"warn_punish_rem": "Having {0} warnings will no longer trigger a punishment.",
|
"warn_punish_rem": "Having {0} warnings will no longer trigger a punishment.",
|
||||||
"warn_punish_set": "I will apply {0} punishment to users with {1} warnings.",
|
"warn_punish_set": "I will apply {0} punishment to users with {1} warnings.",
|
||||||
"warn_punish_set_timed": "I will apply {0} punishment for {2} to users with {1} warnings.",
|
"warn_punish_set_timed": "I will apply {0} punishment for {2} to users with {1} warnings.",
|
||||||
"clpa_obsolete": ":tada: **Patreon currency rewards are now automatic!** :tada:\nThis command is now obsolete.\nIf you did not receive your reward for this month's pledge, below are some of the reasons as to why that might be.",
|
|
||||||
"clpa_fail_already": "Maybe you've already received your reward for this month. You can receive rewards only once a month unless you increase your pledge.\nYou can check it by using `.curtrs` command.",
|
|
||||||
"clpa_fail_already_title": "Already rewarded",
|
|
||||||
"clpa_fail_conn": "Your discord account might not be connected to Patreon. If you are unsure what that means, or don't know how to connect it - you have to go to [Patreon account settings page](https://www.patreon.com/settings/apps) and click 'Connect to discord' button.",
|
|
||||||
"clpa_fail_conn_title": "Discord account not connected",
|
|
||||||
"clpa_fail_sup": "In order to be eligible for the reward, you must support the project on patreon. You can use {0} command to get the link.",
|
|
||||||
"clpa_fail_sup_title": "Not supporting",
|
|
||||||
"clpa_fail_wait": "You have to wait 5-10 minutes after making your pledge (and coonnecting your discord account to your patreon) for your currency to show up.",
|
|
||||||
"clpa_fail_wait_title": "Wait some time",
|
|
||||||
"clpa_too_early": "Rewards can be claimed on or after 5th of each month.",
|
|
||||||
"time_new": "Time",
|
"time_new": "Time",
|
||||||
"timezone": "Timezone",
|
"timezone": "Timezone",
|
||||||
"timezone_db_api_key": "You need to activate your TimezoneDB API key. You can do so by clicking on the link you've received in the email with your API key.",
|
"timezone_db_api_key": "You need to activate your TimezoneDB API key. You can do so by clicking on the link you've received in the email with your API key.",
|
||||||
@@ -701,7 +691,6 @@
|
|||||||
"shop_none": "No shop items found on this page.",
|
"shop_none": "No shop items found on this page.",
|
||||||
"shop_role": "You will get {0} role.",
|
"shop_role": "You will get {0} role.",
|
||||||
"type": "Type",
|
"type": "Type",
|
||||||
"clpa_next_update": "Next update in {0}",
|
|
||||||
"gvc_disabled": "Game Voice Channel feature has been disabled on this server.",
|
"gvc_disabled": "Game Voice Channel feature has been disabled on this server.",
|
||||||
"gvc_enabled": "{0} is a Game Voice Channel now.",
|
"gvc_enabled": "{0} is a Game Voice Channel now.",
|
||||||
"not_in_voice": "You are not in a voice channel on this server.",
|
"not_in_voice": "You are not in a voice channel on this server.",
|
||||||
|
Reference in New Issue
Block a user