-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
715 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { LanguageKeys } from '#lib/i18n/languageKeys'; | ||
import { ModerationCommand } from '#lib/moderation'; | ||
import type { GuildMessage } from '#lib/types'; | ||
import { TypeVariation } from '#utils/moderationConstants'; | ||
import { ApplyOptions } from '@sapphire/decorators'; | ||
import { PermissionFlagsBits } from 'discord.js'; | ||
|
||
type Type = TypeVariation.Timeout; | ||
type ValueType = null; | ||
|
||
@ApplyOptions<ModerationCommand.Options<Type>>({ | ||
description: LanguageKeys.Commands.Moderation.TimeoutApplyDescription, | ||
detailedDescription: LanguageKeys.Commands.Moderation.TimeoutApplyExtended, | ||
requiredClientPermissions: [PermissionFlagsBits.ModerateMembers], | ||
requiredMember: true, | ||
type: TypeVariation.Timeout | ||
}) | ||
export class UserModerationCommand extends ModerationCommand<Type, ValueType> { | ||
protected override async checkTargetCanBeModerated(message: GuildMessage, context: ModerationCommand.HandlerParameters<ValueType>) { | ||
const member = await super.checkTargetCanBeModerated(message, context); | ||
if (member && !member.moderatable) throw context.args.t(LanguageKeys.Commands.Moderation.TimeoutNotModeratable); | ||
return member; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { LanguageKeys } from '#lib/i18n/languageKeys'; | ||
import { ModerationCommand } from '#lib/moderation'; | ||
import { TypeVariation } from '#utils/moderationConstants'; | ||
import { ApplyOptions } from '@sapphire/decorators'; | ||
import { PermissionFlagsBits } from 'discord.js'; | ||
|
||
type Type = TypeVariation.Timeout; | ||
type ValueType = null; | ||
|
||
@ApplyOptions<ModerationCommand.Options<Type>>({ | ||
description: LanguageKeys.Commands.Moderation.TimeoutUndoDescription, | ||
detailedDescription: LanguageKeys.Commands.Moderation.TimeoutUndoExtended, | ||
requiredClientPermissions: [PermissionFlagsBits.ModerateMembers], | ||
requiredMember: true, | ||
isUndoAction: true, | ||
type: TypeVariation.Timeout | ||
}) | ||
export class UserModerationCommand extends ModerationCommand<Type, ValueType> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export const BanAdd = 'eventsBanAdd'; | ||
export const BanRemove = 'eventsBanRemove'; | ||
export const Timeout = 'eventsTimeout'; | ||
export const UnknownMessages = 'eventsUnknownMessages'; | ||
export const IncludeTwemoji = 'eventsTwemojiReactions'; | ||
export const IncludeBots = 'eventsIncludeBots'; |
11 changes: 11 additions & 0 deletions
11
src/lib/database/migrations/1708164874479-V79_AddTimeout.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { TableColumn, type MigrationInterface, type QueryRunner } from 'typeorm'; | ||
|
||
export class V79AddTimeout1708164874479 implements MigrationInterface { | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.addColumn('guilds', new TableColumn({ name: 'events.timeout', type: 'boolean', default: false })); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.dropColumn('guilds', 'events.timeout'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { API } from '@discordjs/core/http-only'; | ||
import { container } from '@sapphire/framework'; | ||
|
||
let instance: API; | ||
export function api() { | ||
return (instance ??= new API(container.client.rest as any)); | ||
return (container.api ??= new API(container.client.rest as any)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.