Update example

This commit is contained in:
ayntee
2020-12-26 19:11:06 +04:00
parent 2ae07da6db
commit e7f917bbdb
2 changed files with 11 additions and 17 deletions

View File

@@ -28,16 +28,22 @@ If you do not wish to use a boilerplate, you may continue reading.
Here's a minimal example to get started with:
```typescript
import startBot, { sendMessage, Intents } from "https://deno.land/x/discordeno@9.4.0/mod.ts";
import {
Intents,
sendMessage,
startBot,
} from "https://deno.land/x/discordeno@9.4.0/mod.ts";
startBot({
token: "BOT TOKEN",
intents: [Intents.GUILD_MESSAGES, Intents.GUILDS],
eventHandlers: {
ready: () => console.log('Successfully connected to gateway'),
messageCreate: (message) => {
if (message.content === "hello") {
sendMessage(message.channelID, "Hi there!");
ready() {
console.log("Successfully connected to gateway");
},
messageCreate(message) {
if (message.content === "ping") {
sendMessage(message.channelID, "Pong using Discordeno!");
}
},
},

12
test.ts
View File

@@ -1,12 +0,0 @@
import { startBot } from "./mod.ts";
await startBot({
token: "NzcxMDU2NzQzNTI1Nzc3NDM4.X5mkjQ.CXt_evCNBYYvNLRy6WbjRQ1v4-Y",
intents: [34508732],
eventHandlers: {
debug: console.log,
ready() {
console.log("Successfully logged in!");
}
}
});