Skip to content

Commit

Permalink
Merge pull request #4 from hubot-friends/preliminary
Browse files Browse the repository at this point in the history
feat: Direct message the bot
  • Loading branch information
joeyguerra authored Sep 4, 2023
2 parents 43120a6 + b36c107 commit 5825717
Show file tree
Hide file tree
Showing 6 changed files with 354 additions and 135 deletions.
9 changes: 7 additions & 2 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { DiscordAdapter } from './src/DiscordAdapter.mjs'
import { Client, GatewayIntentBits } from 'discord.js'
import { Client, GatewayIntentBits, Partials } from 'discord.js'
export default {
async use(robot) {
robot.config = {
DISCORD_TOKEN: process.env.DISCORD_TOKEN ?? null
}
const client = new Client({intents: [GatewayIntentBits.Guilds, GatewayIntentBits.DirectMessages, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions]})
const client = new Client({intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.GuildMessageReactions
], partials: [Partials.Channel, Partials.Message, Partials.User, Partials.Reaction]})
const adapter = new DiscordAdapter(robot, client)
return adapter
}
Expand Down
3 changes: 3 additions & 0 deletions index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const hookModuleToReturnMockFromRequire = (module, mock) => {
class DiscordClient extends EventEmitter {
constructor() {
super()
this.user = {
id: 'test-bot'
}
}
async login(token){
return token
Expand Down
Loading

0 comments on commit 5825717

Please sign in to comment.