[ADD] Be able to set the power level of an admin

Taking over users!
This commit is contained in:
LDA 2024-06-28 23:58:23 +02:00
commit 307fe6a341
3 changed files with 69 additions and 1 deletions

View file

@ -5,6 +5,7 @@
#include <Cytoplasm/Str.h>
#include <Cytoplasm/Log.h>
#include <string.h>
#include <stdlib.h>
#include <Matrix.h>
#include <AS.h>
@ -112,7 +113,7 @@ ParseeBotHandler(ParseeData *data, HashMap *event)
if (cmd && StrEquals(cmd->command, BAN_USER))
{
char *user = HashMapGet(cmd->arguments, "user");
char *room = HashMapGet(cmd->arguments, "user");
char *room = HashMapGet(cmd->arguments, "room");
char *msg;
if (!user || !room)
@ -129,6 +130,25 @@ ParseeBotHandler(ParseeData *data, HashMap *event)
));
Free(msg);
}
else if (cmd && StrEquals(cmd->command, "set-pl"))
{
char *user = HashMapGet(cmd->arguments, "user");
char *room = HashMapGet(cmd->arguments, "room");
char *pl_str = HashMapGet(cmd->arguments, "pl");
long pl = strtol(pl_str, NULL, 10);
HashMap *map;
if (!user || !pl_str)
{
goto end;
}
map = ASGetPL(data->config, room);
JsonValueFree(JsonSet(
map, JsonValueInteger(pl),
2, "users", user
));
ASSetPL(data->config, room, map);
}
else if (cmd && StrEquals(cmd->command, LS_USERS))
{
DbRef *listed = DbLock(data->db, 1, "global_bans");