Skip to content

Commit

Permalink
Upgrade discord.js to v14 (and required Node version to v18)
Browse files Browse the repository at this point in the history
  • Loading branch information
raymond-h committed Sep 1, 2024
1 parent bbcbd7e commit 1e3c633
Show file tree
Hide file tree
Showing 5 changed files with 315 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16.13.x'
node-version: '18.x'
cache: 'npm'
- run: npm ci
- run: npm run lint
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.13.2
FROM node:18.20.4

WORKDIR /app

Expand Down
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require('dotenv').config();

const assert = require('assert');
const Discord = require('discord.js');
const { ChannelType } = require('discord-api-types/v10');
const Keyv = require('keyv');
const KeyvFile = require('keyv-file');
const got = require('got');
Expand Down Expand Up @@ -121,7 +122,7 @@ async function runUserCommand(client, store, msg, data) {
channel: {
id: msg.channel.id,
name: msg.channel.name,
type: msg.channel.type
type: _.snakeCase(ChannelType[msg.channel.type]).toUpperCase()
},
guild: (msg.guild == null) ? null : {
id: msg.guild.id,
Expand All @@ -148,9 +149,9 @@ async function main() {

const client = new Discord.Client({
intents: [
Discord.Intents.FLAGS.GUILDS,
Discord.Intents.FLAGS.GUILD_MESSAGES,
Discord.Intents.FLAGS.MESSAGE_CONTENT
Discord.GatewayIntentBits.Guilds,
Discord.GatewayIntentBits.GuildMessages,
Discord.GatewayIntentBits.MessageContent
]
});
await client.login(process.env.DISCORD_TOKEN);
Expand Down
Loading

0 comments on commit 1e3c633

Please sign in to comment.