Skip to content

Commit

Permalink
fix: discord commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Zamiell committed Sep 29, 2023
1 parent 39236c2 commit 69a8bf2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@t3-oss/env-core": "^0.6.1",
"discord.js": "^14.13.0",
"dotenv": "^16.3.1",
"isaac-racing-common": "^1.0.11",
"isaac-racing-common": "^1.0.13",
"isaacscript": "^3.11.1",
"isaacscript-common-ts": "^11.3.0",
"shutdown-async": "^1.2.3",
Expand All @@ -30,7 +30,7 @@
"zod": "^3.22.2"
},
"devDependencies": {
"@types/node": "^20.7.0",
"@types/node": "^20.7.2",
"@types/tmi.js": "^1.8.4",
"isaacscript-lint": "^5.11.0",
"isaacscript-tsconfig": "^4.0.0",
Expand Down
6 changes: 5 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ import { Client, GatewayIntentBits } from "discord.js";

export const client = new Client({
// An intent is needed for each type of data that we need Discord to send to us.
intents: [GatewayIntentBits.MessageContent],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
});
3 changes: 3 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import isaacRacingCommon from "isaac-racing-common";
import path from "node:path";
import url from "node:url";

Expand All @@ -7,3 +8,5 @@ export const REPO_ROOT = path.join(__dirname, "..");
export const COMMAND_PREFIX_TWITCH = "!";
export const COMMAND_PREFIX_DISCORD = "/";
export const CLIENT_LOBBY_CHANNEL_ID = "286115994621968384";

export const { BUILDS, CHARACTERS } = isaacRacingCommon;
12 changes: 2 additions & 10 deletions src/discordCommandMap.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type discord from "discord.js";
import { ChannelType } from "discord.js";
import { ReadonlyMap } from "isaacscript-common-ts";
import { CLIENT_LOBBY_CHANNEL_ID } from "./constants.js";
import { ReadonlyMap, getRandomArrayElement } from "isaacscript-common-ts";
import { BUILDS, CHARACTERS, CLIENT_LOBBY_CHANNEL_ID } from "./constants.js";
import { discordSend } from "./discordUtils.js";

export const DISCORD_COMMAND_MAP = new ReadonlyMap<
Expand All @@ -20,25 +20,17 @@ function buildFunc(message: discord.Message) {
return;
}

/*
const build = getRandomArrayElement(BUILDS);
discordSend(message.channel, `Random build: ${build.name}`);
*/

discordSend(message.channel, "This feature is temporarily unavailable.");
}

function characterFunc(message: discord.Message) {
if (message.channel.type !== ChannelType.GuildText) {
return;
}

/*
const character = getRandomArrayElement(CHARACTERS);
discordSend(message.channel, `Random character: ${character}`);
*/

discordSend(message.channel, "This feature is temporarily unavailable.");
}

function helpFunc(message: discord.Message) {
Expand Down
1 change: 1 addition & 0 deletions src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dotenv.config({
});

// TODO: https://github.com/t3-oss/t3-env/issues/109
// TODO: https://github.com/t3-oss/t3-env/pull/113
for (const [key, value] of Object.entries(process.env)) {
if (value === "") {
delete process.env[key]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1376,10 +1376,10 @@ __metadata:
languageName: node
linkType: hard

"@types/node@npm:^20.7.0":
version: 20.7.0
resolution: "@types/node@npm:20.7.0"
checksum: 1b2919925c213f4d2039ada7a8354c998e144f7291db8d719ef58ea9924ab636c113690073b0ec3b82ba62907385f7e0f51e9d1583c1a818776daa5156d3a590
"@types/node@npm:^20.7.2":
version: 20.7.2
resolution: "@types/node@npm:20.7.2"
checksum: 5baa09368c8daa50ad1eaa2499b988b2f4c06cacf8b251d1e63f68ad32df97b21d8104f1ac06889481f1d3e84056842732bb848dd1136164d823c1d4a6baf435
languageName: node
linkType: hard

Expand Down Expand Up @@ -4416,10 +4416,10 @@ __metadata:
languageName: node
linkType: hard

"isaac-racing-common@npm:^1.0.11":
version: 1.0.11
resolution: "isaac-racing-common@npm:1.0.11"
checksum: 327d9f60e1e88190b70b1d3c7f7feda73368d4f8a8dc4e7e80b0cfeee06a35e7715ce7784e09b5473b6c780416671310caf8f8b3785a6248db209215c602cbef
"isaac-racing-common@npm:^1.0.13":
version: 1.0.13
resolution: "isaac-racing-common@npm:1.0.13"
checksum: 1a4e7f566eba4840cb7366cac5fd0005f1cc536f291156c15ae7117dfd5e3864d67b1b4e1ab33e7cdfa57c3c3b6cdc39070e470460b82b2ac2a56aeac4b81771
languageName: node
linkType: hard

Expand Down Expand Up @@ -7459,11 +7459,11 @@ __metadata:
resolution: "zamiel-bot@workspace:."
dependencies:
"@t3-oss/env-core": ^0.6.1
"@types/node": ^20.7.0
"@types/node": ^20.7.2
"@types/tmi.js": ^1.8.4
discord.js: ^14.13.0
dotenv: ^16.3.1
isaac-racing-common: ^1.0.11
isaac-racing-common: ^1.0.13
isaacscript: ^3.11.1
isaacscript-common-ts: ^11.3.0
isaacscript-lint: ^5.11.0
Expand Down

0 comments on commit 69a8bf2

Please sign in to comment.