Skip to content

Commit

Permalink
Move config type to config service
Browse files Browse the repository at this point in the history
  • Loading branch information
holzmaster committed Jul 14, 2024
1 parent 398fbef commit 6bce6f4
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 102 deletions.
1 change: 0 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { GatewayIntentBits, Partials, Client } from "discord.js";
import * as sentry from "@sentry/node";


import { readConfig, databasePath, args } from "./service/configService.js";
import log from "@log";

Expand Down
2 changes: 1 addition & 1 deletion src/commands/woisvote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
TimestampStyles,
} from "discord.js";

import type { ReactionHandler } from "../handler/ReactionHandler.js";
import type { ApplicationCommand } from "./command.js";
import * as woisAction from "../storage/woisAction.js";
import type { ReactionHandler } from "../types.js";
import type { BotContext } from "../context.js";
import { chunkArray } from "../utils/arrayUtils.js";
import log from "@log";
Expand Down
99 changes: 98 additions & 1 deletion src/service/configService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as fs from "node:fs/promises";
import * as path from "node:path";
import { parseArgs } from "node:util";

import type { Config } from "../types.js";
import type { Snowflake, ActivityType } from "discord.js";

import log from "@log";

const configPath = path.resolve("config.json");
Expand Down Expand Up @@ -43,3 +44,99 @@ export const args = parseArgs({
},
},
});

export interface Config {
auth: {
clientId: string;
token: string;
};

sentry?: {
dsn?: string | null;
};

activity: {
type: ActivityType;
name: string;
state?: string;
url?: string;
};

prefix: {
command: string;
modCommand: string;
};

moderatorRoleIds: readonly Snowflake[];

command: {
faulenzerPing: {
allowedRoleIds: readonly Snowflake[];
maxNumberOfPings: number;
minRequiredReactions: number;
};
woisPing: {
limit: number;
threshold: number;
};
ehre: {
emojiNames: readonly string[];
};
instagram: {
rapidApiInstagramApiKey?: string | null;
};
loot: {
enabled: boolean;
scheduleCron: string;
dropChance: number;
allowedChannelIds?: Array<Snowflake> | null;
/** ISO8601 duration */
max_time_passed_since_last_message: string;
};
quotes: {
emojiName: string;
allowedGroupIds: readonly Snowflake[];
anonymousChannelIds: readonly Snowflake[];
anonymousCategoryIds: readonly Snowflake[];
voteThreshold: number;
blacklistedChannelIds: readonly Snowflake[];
targetChannelOverrides: Record<string, string>;
defaultTargetChannelId: Snowflake;
};
};

deleteThreadMessagesInChannelIds: readonly Snowflake[];
flameTrustedUserOnBotPing: boolean;

guildGuildId: Snowflake;

textChannel: {
banReasonChannelId: Snowflake;
bannedChannelId: Snowflake;
botLogChannelId: Snowflake;
hauptchatChannelId: Snowflake;
votesChannelId: Snowflake;
botSpamChannelId: Snowflake;
hauptwoisTextChannelId: Snowflake;
};

voiceChannel: {
hauptWoischatChannelId: Snowflake;
};

role: {
bannedRoleId: Snowflake;
birthdayRoleId: Snowflake;
botDenyRoleId: Snowflake;
defaultRoleId: Snowflake;
gruendervaeterRoleId: Snowflake;
gruendervaeterBannedRoleId: Snowflake;
roleDenyRoleId: Snowflake;
shameRoleId: Snowflake;
trustedRoleId: Snowflake;
trustedBannedRoleId: Snowflake;
woisgangRoleId: Snowflake;
winnerRoleId: Snowflake;
emotifiziererRoleId: Snowflake;
};
}
99 changes: 0 additions & 99 deletions src/types.d.ts

This file was deleted.

0 comments on commit 6bce6f4

Please sign in to comment.