Added .exds to complement .exas

This commit is contained in:
Kwoth
2022-09-09 21:02:16 +02:00
parent f1c7d7437a
commit 8107a80c4c
4 changed files with 35 additions and 10 deletions

View File

@@ -2,6 +2,12 @@
Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.com/en/1.0.0/) except date format. a-c-f-r-o
## Unreleased
### Added
- Added `.exprdelserv` (.exds) to completement .exas. Deletes an expression on the current server and is susceptible to .dpo, unlike .exd
## [4.3.6] - 08.09.2022 ## [4.3.6] - 08.09.2022
### Added ### Added

View File

@@ -160,15 +160,8 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
found.Response.TrimTo(1000).Replace("](", "]\\("))); found.Response.TrimTo(1000).Replace("](", "]\\(")));
} }
[Cmd] public async Task ExprDeleteInternalAsync(kwum id)
public async Task ExprDelete(kwum id)
{ {
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync(strs.expr_insuff_perms);
return;
}
var ex = await _service.DeleteAsync(ctx.Guild?.Id, id); var ex = await _service.DeleteAsync(ctx.Guild?.Id, id);
if (ex is not null) if (ex is not null)
@@ -186,6 +179,24 @@ public partial class NadekoExpressions : NadekoModule<NadekoExpressionsService>
} }
} }
[Cmd]
[UserPerm(GuildPerm.Administrator)]
[RequireContext(ContextType.Guild)]
public async Task ExprDeleteServer(kwum id)
=> await ExprDeleteInternalAsync(id);
[Cmd]
public async Task ExprDelete(kwum id)
{
if (!AdminInGuildOrOwnerInDm())
{
await ReplyErrorLocalizedAsync(strs.expr_insuff_perms);
return;
}
await ExprDeleteInternalAsync(id);
}
[Cmd] [Cmd]
public async Task ExprReact(kwum id, params string[] emojiStrs) public async Task ExprReact(kwum id, params string[] emojiStrs)
{ {

View File

@@ -1309,6 +1309,10 @@ exprdelete:
- exd - exd
- exdel - exdel
- dcr - dcr
exprdeleteserver:
- exprdelserv
- exds
- exdelserv
exprclear: exprclear:
- exprclear - exprclear
- exc - exc

View File

@@ -217,13 +217,17 @@ exprlist:
- "1" - "1"
- "all" - "all"
exprshow: exprshow:
desc: "Shows a expression's response on a given ID." desc: "Shows an expression's response on a given ID."
args: args:
- "1" - "1"
exprdelete: exprdelete:
desc: "Deletes a expression on a specific index. If ran in DM, it is bot owner only and deletes a global expression. If ran in a server, it requires Administration privileges and removes server expression." desc: "Deletes an expression on a specific index. If ran in DM, it is bot owner only and deletes a global expression. If ran in a server, it requires Administration privileges and removes server expression."
args: args:
- "5" - "5"
exprdeleteserver:
desc: "Deletes an expression on a specific index on this server."
args:
- "5c"
exprclear: exprclear:
desc: "Deletes all expression on this server." desc: "Deletes all expression on this server."
args: args: