- 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:
Kwoth
2021-12-31 16:04:12 +01:00
parent 6eee161b6b
commit 25eeffa163
107 changed files with 1620 additions and 3236 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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))

View File

@@ -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))

View File

@@ -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;

View File

@@ -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("-"))

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;