You can now target a different channel with .repeat, for example: .repeat #some-other-channel 15m Quick reminder

This commit is contained in:
Kwoth
2024-04-24 22:59:45 +00:00
parent 49563ea6d4
commit e1d027eaf5
2 changed files with 53 additions and 15 deletions

View File

@@ -16,6 +16,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
- `.ga list` lists active giveaways on the current server
- `.ga reroll <id>` rerolls the winner on the completed giveaway. This only works for 24 hours after the giveaway has ended, or until the bot restarts.
- After the giveaway has started, user join the giveaway by adding a :tada: reaction
- You can now target a different channel with .repeat, for example `.repeat #some-other 1h Hello every hour`
## [4.3.22] - 23.04.2023

View File

@@ -1,4 +1,5 @@
using NadekoBot.Common.TypeReaders;
using LinqToDB.Common;
using NadekoBot.Common.TypeReaders;
using NadekoBot.Common.TypeReaders.Models;
using NadekoBot.Modules.Utility.Services;
@@ -95,16 +96,30 @@ public partial class Utility
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(-1)]
[Priority(-2)]
public Task Repeat([Leftover] string message)
=> Repeat(null, null, message);
=> Repeat(ctx.Channel, null, null, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(-1)]
public Task Repeat(ITextChannel channel, [Leftover] string message)
=> Repeat(channel, null, null, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(0)]
public Task Repeat(StoopidTime interval, [Leftover] string message)
=> Repeat(null, interval, message);
=> Repeat(ctx.Channel, null, interval, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(0)]
public Task Repeat(ITextChannel ch, StoopidTime interval, [Leftover] string message)
=> Repeat(ch, null, interval, message);
[Cmd]
[RequireContext(ContextType.Guild)]
@@ -113,12 +128,34 @@ public partial class Utility
public Task Repeat(GuildDateTime dt, [Leftover] string message)
=> Repeat(dt, null, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(1)]
public Task Repeat(ITextChannel channel, GuildDateTime dt, [Leftover] string message)
=> Repeat(channel, dt, null, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(2)]
public async Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
public Task Repeat(GuildDateTime? dt, StoopidTime? interval, [Leftover] string message)
=> Repeat(ctx.Channel, dt, interval, message);
[Cmd]
[RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.ManageMessages)]
[Priority(3)]
public async Task Repeat(IMessageChannel channel, GuildDateTime? dt, StoopidTime? interval,
[Leftover] string message)
{
if (channel is not ITextChannel txtCh || txtCh.GuildId != ctx.Guild.Id)
return;
var perms = ((IGuildUser)ctx.User).GetPermissions(txtCh);
if (!perms.SendMessages)
return;
var startTimeOfDay = dt?.InputTimeUtc.TimeOfDay;
// if interval not null, that means user specified it (don't change it)
@@ -137,7 +174,7 @@ public partial class Utility
? message
: message.SanitizeMentions(true);
var runner = await _service.AddRepeaterAsync(ctx.Channel.Id,
var runner = await _service.AddRepeaterAsync(channel.Id,
ctx.Guild.Id,
realInterval,
message,