3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00

Allow mentions in "!clean user"; fix some clean command bugs

This commit is contained in:
Dragory 2018-11-24 19:42:51 +02:00
parent 9687359105
commit 22c515be38
2 changed files with 6 additions and 2 deletions

View file

@ -83,6 +83,7 @@ export class GuildSavedMessages extends BaseRepository {
.where("guild_id = :guild_id", { guild_id: this.guildId })
.andWhere("channel_id = :channel_id", { channel_id: channelId })
.andWhere("is_bot = 1")
.andWhere("deleted_at IS NULL")
.orderBy("id", "DESC")
.limit(limit)
.getMany();
@ -94,6 +95,7 @@ export class GuildSavedMessages extends BaseRepository {
.where("guild_id = :guild_id", { guild_id: this.guildId })
.andWhere("channel_id = :channel_id", { channel_id: channelId })
.andWhere("id < :beforeId", { beforeId })
.andWhere("deleted_at IS NULL")
.orderBy("id", "DESC")
.limit(limit)
.getMany();
@ -105,6 +107,7 @@ export class GuildSavedMessages extends BaseRepository {
.where("guild_id = :guild_id", { guild_id: this.guildId })
.andWhere("channel_id = :channel_id", { channel_id: channelId })
.andWhere("user_id = :user_id", { user_id: userId })
.andWhere("deleted_at IS NULL")
.orderBy("id", "DESC")
.limit(limit)
.getMany();
@ -116,7 +119,8 @@ export class GuildSavedMessages extends BaseRepository {
.where("guild_id = :guild_id", { guild_id: this.guildId })
.andWhere("user_id = :user_id", { user_id: userId })
.andWhere("channel_id = :channel_id", { channel_id: channelId })
.andWhere("id > :afterId", { afterId });
.andWhere("id > :afterId", { afterId })
.andWhere("deleted_at IS NULL");
if (limit != null) {
query = query.limit(limit);

View file

@ -178,7 +178,7 @@ export class UtilityPlugin extends Plugin {
}, CLEAN_COMMAND_DELETE_DELAY);
}
@d.command("clean user", "<userId:string> <count:number>")
@d.command("clean user", "<userId:userid> <count:number>")
@d.permission("clean")
async cleanUserCmd(msg: Message, args: { userId: string; count: number }) {
if (args.count > MAX_CLEAN_COUNT || args.count <= 0) {