.delete will now accept a message link
This commit is contained in:
parent
96ce7b192e
commit
bc4ab57a67
2 changed files with 24 additions and 5 deletions
src/EllieBot
|
@ -97,9 +97,9 @@ public partial class Administration : EllieModule<AdministrationService>
|
|||
var (enabled, channels) = _service.GetDelMsgOnCmdData(ctx.Guild.Id);
|
||||
|
||||
var embed = CreateEmbed()
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText(strs.server_delmsgoncmd))
|
||||
.WithDescription(enabled ? "✅" : "❌");
|
||||
.WithOkColor()
|
||||
.WithTitle(GetText(strs.server_delmsgoncmd))
|
||||
.WithDescription(enabled ? "✅" : "❌");
|
||||
|
||||
var str = string.Join("\n",
|
||||
channels.Select(x =>
|
||||
|
@ -301,6 +301,16 @@ public partial class Administration : EllieModule<AdministrationService>
|
|||
public Task Delete(ulong messageId, ParsedTimespan timespan = null)
|
||||
=> Delete((ITextChannel)ctx.Channel, messageId, timespan);
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Delete(MessageLink messageLink, ParsedTimespan timespan = null)
|
||||
{
|
||||
if (messageLink.Channel is not ITextChannel tc)
|
||||
return;
|
||||
|
||||
await Delete(tc, messageLink.Message.Id, timespan);
|
||||
}
|
||||
|
||||
[Cmd]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
public async Task Delete(ITextChannel channel, ulong messageId, ParsedTimespan timespan = null)
|
||||
|
@ -373,7 +383,8 @@ public partial class Administration : EllieModule<AdministrationService>
|
|||
if (ctx.Channel is not SocketTextChannel stc)
|
||||
return;
|
||||
|
||||
var t = stc.Threads.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase));
|
||||
var t = stc.Threads.FirstOrDefault(
|
||||
x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
if (t is null)
|
||||
{
|
||||
|
|
|
@ -4134,7 +4134,11 @@ edit:
|
|||
text:
|
||||
desc: "The new text content of the edited message."
|
||||
delete:
|
||||
desc: Deletes a single message given the channel and message ID. If channel is ommited, message will be searched for in the current channel. You can also specify time parameter after which the message will be deleted (up to 7 days). This timer won't persist through bot restarts.
|
||||
desc: |-
|
||||
Deletes a single message given the channel and message ID, or a message link.
|
||||
If channel is omitted, message will be searched for in the current channel.
|
||||
You can also specify time parameter after which the message will be deleted (up to 7 days).
|
||||
This timer won't persist through bot restarts.
|
||||
ex:
|
||||
- '#chat 771562360594628608'
|
||||
- 771562360594628608
|
||||
|
@ -4144,6 +4148,10 @@ delete:
|
|||
desc: "The id of a specific message within a channel, used to target the deletion operation."
|
||||
time:
|
||||
desc: "The duration after which the message should be automatically deleted."
|
||||
- messageLink:
|
||||
desc: "The link of the message to delete. It must be on the same server."
|
||||
time:
|
||||
desc: "The duration after which the message should be automatically deleted."
|
||||
- channel:
|
||||
desc: "The channel where the message is located or should be searched for."
|
||||
messageId:
|
||||
|
|
Loading…
Add table
Reference in a new issue