Skip to content

Commit

Permalink
feat: add status message
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Nov 30, 2023
1 parent f125559 commit 582472c
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DISCORD_APP_ID=00000
DISCORD_BOT_TOKEN=your_discord_bot_token
DISCORD_APP_ID="00000"
DISCORD_BOT_TOKEN="your_discord_bot_token"

GUILD_ID=00000
TERMINAL_CHANNEL_ID=00000
GUILD_ID="00000"
TERMINAL_CHANNEL_ID="00000"
41 changes: 28 additions & 13 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,32 @@

require('dotenv').config()

const { Client, Intents } = require('discord.js');
const {
Client,
Partials,
GatewayIntentBits,
PresenceUpdateStatus,
ActivityType,
} = require('discord.js');
const { ReactionRole } = require("discordjs-reaction-role");

const roles = require('./roles.json');

const client = new Client({
partials: [
"CHANNEL",
"MESSAGE",
"REACTION",
],
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGE_TYPING
]
partials: [
Partials.Channel,
Partials.Message,
Partials.Reaction,
],
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.DirectMessageTyping,
GatewayIntentBits.MessageContent,
],
});
const roleManager = new ReactionRole(client, roles);

Expand All @@ -43,6 +51,13 @@ for (const [key, item] of Object.entries(triggers)) {

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
client.user.setPresence({
status: PresenceUpdateStatus.Online,
activities: [{
type: ActivityType.Playing,
name: "黑客帝國",
}],
});
});

client.on('messageReactionAdd', (reaction, user) => {
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"start": "node app.js"
},
"dependencies": {
"@discordjs/rest": "^0.3.0",
"discord-api-types": "^0.27.3",
"discord.js": "^13.6.0",
"discordjs-reaction-role": "^3.0.0",
"dotenv": "^10.0.0",
"express": "^4.16.1",
"jsonwebtoken": "^8.5.1"
"@discordjs/rest": "^2.2.0",
"discord-api-types": "^0.37.65",
"discord.js": "^14.14.1",
"discordjs-reaction-role": "^3.1.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"jsonwebtoken": "^9.0.2"
},
"devDependencies": {
"nodemon": "^2.0.13"
"nodemon": "^3.0.1"
}
}

0 comments on commit 582472c

Please sign in to comment.