mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-11 01:38:27 -04:00
Added .threadcreate and .threaddelete commadns which create and delete public threads
This commit is contained in:
@@ -344,4 +344,36 @@ public partial class Administration : NadekoModule<AdministrationService>
|
|||||||
|
|
||||||
await ctx.OkAsync();
|
await ctx.OkAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Cmd]
|
||||||
|
[BotPerm(ChannelPermission.CreatePublicThreads)]
|
||||||
|
[UserPerm(ChannelPermission.CreatePublicThreads)]
|
||||||
|
public async Task ThreadCreate([Leftover] string name)
|
||||||
|
{
|
||||||
|
if (ctx.Channel is not SocketTextChannel stc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
await stc.CreateThreadAsync(name, message: ctx.Message.ReferencedMessage);
|
||||||
|
await ctx.OkAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Cmd]
|
||||||
|
[BotPerm(ChannelPermission.ManageThreads)]
|
||||||
|
[UserPerm(ChannelPermission.ManageThreads)]
|
||||||
|
public async Task ThreadDelete([Leftover] string name)
|
||||||
|
{
|
||||||
|
if (ctx.Channel is not SocketTextChannel stc)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var t = stc.Threads.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase));
|
||||||
|
|
||||||
|
if (t is null)
|
||||||
|
{
|
||||||
|
await ReplyErrorLocalizedAsync(strs.not_found);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await t.DeleteAsync();
|
||||||
|
await ctx.OkAsync();
|
||||||
|
}
|
||||||
}
|
}
|
@@ -174,6 +174,14 @@ settopic:
|
|||||||
setchanlname:
|
setchanlname:
|
||||||
- setchanlname
|
- setchanlname
|
||||||
- schn
|
- schn
|
||||||
|
# thread stuff
|
||||||
|
threadcreate:
|
||||||
|
- threadcreate
|
||||||
|
- thcr
|
||||||
|
threaddelete:
|
||||||
|
- threaddelete
|
||||||
|
- thdel
|
||||||
|
- thrm
|
||||||
prune:
|
prune:
|
||||||
- prune
|
- prune
|
||||||
- clear
|
- clear
|
||||||
|
@@ -2286,3 +2286,11 @@ bettest:
|
|||||||
- ""
|
- ""
|
||||||
- "betflip 1000"
|
- "betflip 1000"
|
||||||
- "slot 2000"
|
- "slot 2000"
|
||||||
|
threadcreate:
|
||||||
|
desc: "Create a public thread with the specified title. You may optionally reply to a message to have it as a starting point."
|
||||||
|
args:
|
||||||
|
- "Q&A"
|
||||||
|
threaddelete:
|
||||||
|
desc: "Delete a thread with the specified name in this channel. Case insensitive."
|
||||||
|
args:
|
||||||
|
- "Q&A"
|
Reference in New Issue
Block a user