feat: display the quest type in the title, and change the prefix in dev mode
This commit is contained in:
@@ -2,10 +2,10 @@
|
|||||||
"name": "@lbf/discord-bot",
|
"name": "@lbf/discord-bot",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "COMMIT_SHA=$(git rev-parse --short HEAD)-dev tsx src/index.ts",
|
"dev": "NODE_ENV=development COMMIT_SHA=$(git rev-parse --short HEAD)-dev tsx src/index.ts",
|
||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
"build": "rm -rf dist && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json",
|
"build": "rm -rf dist && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json",
|
||||||
"dev:user": "COMMIT_SHA=$(git rev-parse --short HEAD)-dev tsx src/index.ts -- --user",
|
"dev:user": "NODE_ENV=development COMMIT_SHA=$(git rev-parse --short HEAD)-dev tsx src/index.ts -- --user",
|
||||||
"check": "tsc --noEmit && eslint src/"
|
"check": "tsc --noEmit && eslint src/"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -13,12 +13,13 @@ export const queteCommand: Command = {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const color = parseInt(quest.quest.promoImagePrimaryColor.substring(1), 16);
|
const color = parseInt(quest.quest.promoImagePrimaryColor.substring(1), 16);
|
||||||
|
const emoji = quest.quest.purchasableWithGems ? "💎" : "🪙";
|
||||||
|
|
||||||
await message.channel.send({
|
await message.channel.send({
|
||||||
options: noMention,
|
options: noMention,
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setTitle("Quête actuelle")
|
.setDescription(`### Quête actuelle ${emoji}${emoji}${emoji}`)
|
||||||
.setImage(quest.quest.promoImageUrl)
|
.setImage(quest.quest.promoImageUrl)
|
||||||
.setColor(color)
|
.setColor(color)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { parseEnv } from "@lbf-bot/utils";
|
import { parseEnv } from "@lbf-bot/utils";
|
||||||
|
|
||||||
// TODO: use parseEnv from utils
|
|
||||||
|
|
||||||
export const env = parseEnv({
|
export const env = parseEnv({
|
||||||
|
NODE_ENV: z.enum(["development", "production"]).default("production"),
|
||||||
DISCORD_BOT_TOKEN: z.string(),
|
DISCORD_BOT_TOKEN: z.string(),
|
||||||
DISCORD_MENTION: z.string(),
|
DISCORD_MENTION: z.string(),
|
||||||
DISCORD_REWARDS_GIVER: z.string(),
|
DISCORD_REWARDS_GIVER: z.string(),
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { trackingCron } from "~/tracking";
|
|||||||
import { commands } from "~/commands";
|
import { commands } from "~/commands";
|
||||||
import { handleReportButton, handleReportModal, handleEditButton, handleDeleteButton, handleEditModal, REPORT_BUTTON_ID, REPORT_MODAL_ID, REPORT_EDIT_BUTTON_PREFIX, REPORT_DELETE_BUTTON_PREFIX, REPORT_EDIT_MODAL_PREFIX } from "~/reporting";
|
import { handleReportButton, handleReportModal, handleEditButton, handleDeleteButton, handleEditModal, REPORT_BUTTON_ID, REPORT_MODAL_ID, REPORT_EDIT_BUTTON_PREFIX, REPORT_DELETE_BUTTON_PREFIX, REPORT_EDIT_MODAL_PREFIX } from "~/reporting";
|
||||||
|
|
||||||
|
const PREFIX = env.NODE_ENV === "development" ? "lbf_" : "lbf";
|
||||||
|
|
||||||
const onReady = async (client: Client<true>) => {
|
const onReady = async (client: Client<true>) => {
|
||||||
logger.info(`Client ready`);
|
logger.info(`Client ready`);
|
||||||
logger.info(`Connected as @${client.user.username}`);
|
logger.info(`Connected as @${client.user.username}`);
|
||||||
@@ -21,7 +23,7 @@ const onMessage = async (message: OmitPartialGroupDMChannel<Message>) => {
|
|||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
const parts = message.content.trim().split(/\s+/);
|
const parts = message.content.trim().split(/\s+/);
|
||||||
if (parts[0]?.toLowerCase() === "lbf") {
|
if (parts[0]?.toLowerCase() === PREFIX) {
|
||||||
const [commandName, ...args] = parts.slice(1);
|
const [commandName, ...args] = parts.slice(1);
|
||||||
|
|
||||||
const command = commands[commandName];
|
const command = commands[commandName];
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export type QuestResult = {
|
|||||||
id: string;
|
id: string;
|
||||||
promoImageUrl: string;
|
promoImageUrl: string;
|
||||||
promoImagePrimaryColor: string;
|
promoImagePrimaryColor: string;
|
||||||
|
purchasableWithGems: boolean;
|
||||||
};
|
};
|
||||||
participants: Array<QuestParticipant>;
|
participants: Array<QuestParticipant>;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user