Skip to content

Commit 23f67a3

Browse files
committed
Create constants files to make them easier to find (and fix an error)
1 parent 9cf2abd commit 23f67a3

11 files changed

Lines changed: 22 additions & 17 deletions

File tree

backend/src/plugin/core/commandEngine/handler/componentHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
AUTO_DEFER_AFTER,
66
STATE_CLEANUP_INTERVAL,
77
STATE_EXPIRE_AFTER,
8-
} from "#plugin/core/commandEngine/index.ts";
8+
} from "#plugin/core/constants.ts";
99
import { transformReply } from "#plugin/core/helper/commands.ts";
1010
import type {
1111
ComponentContext,

backend/src/plugin/core/commandEngine/handler/prefixHandler.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ import {
99
listenForInteractions,
1010
unlistenForInteractions,
1111
} from "#plugin/core/commandEngine/handler/componentHandler.ts";
12-
import {
13-
STATE_CLEANUP_INTERVAL,
14-
STATE_EXPIRE_AFTER,
15-
} from "#plugin/core/commandEngine/index.ts";
1612
import { formatArgsParseError } from "#plugin/core/commandEngine/parsing/index.ts";
1713
import {
1814
readPrefixArgs,
1915
readPrefixName,
2016
} from "#plugin/core/commandEngine/parsing/prefixParser.ts";
2117
import { StringReader } from "#plugin/core/commandEngine/parsing/stringReader.ts";
18+
import {
19+
STATE_CLEANUP_INTERVAL,
20+
STATE_EXPIRE_AFTER,
21+
} from "#plugin/core/constants.ts";
2222
import { transformReply } from "#plugin/core/helper/commands.ts";
2323
import { coreConfigStore } from "#plugin/core/index.ts";
2424
import type {

backend/src/plugin/core/commandEngine/handler/slashHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import {
1313
listenForInteractions,
1414
unlistenForInteractions,
1515
} from "#plugin/core/commandEngine/handler/componentHandler.ts";
16-
import { AUTO_DEFER_AFTER } from "#plugin/core/commandEngine/index.ts";
1716
import { formatArgsParseError } from "#plugin/core/commandEngine/parsing/index.ts";
1817
import { readSlashArgs } from "#plugin/core/commandEngine/parsing/slashParser.ts";
18+
import { AUTO_DEFER_AFTER } from "#plugin/core/constants.ts";
1919
import { safePreRun, transformReply } from "#plugin/core/helper/commands.ts";
2020
import { coreConfigStore } from "#plugin/core/index.ts";
2121
import {
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { HOUR, MINUTE } from "#common/time.ts";
2+
3+
export const MESSAGE_CLEANUP_INTERVAL = 30 * MINUTE;
4+
export const MESSAGE_CLEANUP_THRESHOLD = 6 * HOUR;

backend/src/plugin/logging/logger/messages.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import { getDefaultAvatarURL } from "#common/discord/urls.ts";
22
import { moduleLogger } from "#common/logger/index.ts";
33
import { makeMemberUserView, makeUserView } from "#common/template/user.ts";
4-
import { HOUR, MINUTE } from "#common/time.ts";
54
import { onBotInit } from "#discord/extensionPoints.ts";
65
import type { SquirrelDiscordContext } from "#discord/index.ts";
76
import { onBotEvent } from "#plugin/core/public/extensionPoints.ts";
7+
import {
8+
MESSAGE_CLEANUP_INTERVAL,
9+
MESSAGE_CLEANUP_THRESHOLD,
10+
} from "#plugin/logging/constants.ts";
811
import { logEvent } from "#plugin/logging/helper/logging.ts";
912
import { loggingConfigStore } from "#plugin/logging/index.ts";
1013
import {
@@ -17,9 +20,6 @@ import { Message, Routes, type PossiblyUncachedMessage } from "oceanic.js";
1720

1821
const logger = moduleLogger();
1922

20-
const MESSAGE_CLEANUP_INTERVAL = 30 * MINUTE;
21-
const MESSAGE_CLEANUP_THRESHOLD = 6 * HOUR;
22-
2323
export default [
2424
onBotInit(beginMessageCleanupLoop),
2525
onBotEvent({ type: "messageCreate", listener: handleCreate }),

backend/src/plugin/tags/command/tag.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { OptionType } from "#plugin/core/public/command.ts";
33
import { defineCommand } from "#plugin/core/public/extensionPoints.ts";
44
import { permissionsGuard } from "#plugin/core/public/helper/commandGuards.ts";
55
import { icons } from "#plugin/core/public/icons.ts";
6-
import { MAX_TAG_NAME_LENGTH, tagsConfigStore } from "#plugin/tags/index.ts";
6+
import { MAX_TAG_NAME_LENGTH } from "#plugin/tags/constants.ts";
7+
import { tagsConfigStore } from "#plugin/tags/index.ts";
78
import { getTag, searchTags } from "#plugin/tags/storage/tags.ts";
89

910
export default defineCommand({

backend/src/plugin/tags/command/tagDelete.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { OptionType } from "#plugin/core/public/command.ts";
33
import { defineCommand } from "#plugin/core/public/extensionPoints.ts";
44
import { permissionsGuard } from "#plugin/core/public/helper/commandGuards.ts";
55
import { icons } from "#plugin/core/public/icons.ts";
6-
import { MAX_TAG_NAME_LENGTH, tagsConfigStore } from "#plugin/tags/index.ts";
6+
import { MAX_TAG_NAME_LENGTH } from "#plugin/tags/constants.ts";
7+
import { tagsConfigStore } from "#plugin/tags/index.ts";
78
import { deleteTag, searchTags } from "#plugin/tags/storage/tags.ts";
89

910
export default defineCommand({

backend/src/plugin/tags/command/tagSet.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import { icons } from "#plugin/core/public/icons.ts";
66
import {
77
MAX_TAG_CONTENT_LENGTH,
88
MAX_TAG_NAME_LENGTH,
9-
tagsConfigStore,
10-
} from "#plugin/tags/index.ts";
9+
} from "#plugin/tags/constants.ts";
10+
import { tagsConfigStore } from "#plugin/tags/index.ts";
1111
import {
1212
createTag,
1313
searchTags,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const MAX_TAG_NAME_LENGTH = 30;
2+
export const MAX_TAG_CONTENT_LENGTH = 4000;

0 commit comments

Comments
 (0)