2021-02-01 08:37:54 +00:00
|
|
|
import { Client, Message, GatewayIntents } from '../mod.ts'
|
2020-11-06 07:31:53 +00:00
|
|
|
|
2020-11-08 07:58:24 +00:00
|
|
|
const client = new Client()
|
2020-11-06 07:31:53 +00:00
|
|
|
|
2020-11-08 07:58:24 +00:00
|
|
|
client.on('ready', () => {
|
|
|
|
console.log(`Logged in as ${client.user?.tag}!`)
|
|
|
|
})
|
2020-11-06 07:31:53 +00:00
|
|
|
|
2020-11-08 07:58:24 +00:00
|
|
|
client.on('messageCreate', (msg: Message) => {
|
|
|
|
if (msg.content === '!ping') {
|
|
|
|
console.log('Command Used: Ping')
|
|
|
|
msg.reply('pong!')
|
|
|
|
}
|
|
|
|
})
|
2020-11-06 07:31:53 +00:00
|
|
|
|
2021-02-01 08:37:54 +00:00
|
|
|
console.log('Harmony - Ping Example')
|
2020-11-06 07:31:53 +00:00
|
|
|
|
2020-11-08 07:58:24 +00:00
|
|
|
const token = prompt('Input Bot Token:')
|
2020-11-07 02:53:42 +00:00
|
|
|
if (token === null) {
|
2020-11-08 07:58:24 +00:00
|
|
|
console.log('No token provided')
|
|
|
|
Deno.exit()
|
2020-11-06 07:31:53 +00:00
|
|
|
}
|
|
|
|
|
2021-02-01 08:37:54 +00:00
|
|
|
client.connect(token, [
|
|
|
|
GatewayIntents.GUILD_MESSAGES,
|
|
|
|
GatewayIntents.GUILDS,
|
|
|
|
GatewayIntents.DIRECT_MESSAGES
|
|
|
|
])
|