From 61cb7b26fba249b50d08f86c6ba7a68ef6bd058e Mon Sep 17 00:00:00 2001 From: Yuzu Date: Sun, 17 Jul 2022 20:54:10 -0500 Subject: [PATCH] chore: fancy stuff --- README.md | 2 ++ hello.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 hello.ts diff --git a/README.md b/README.md index 540be9d..ad19a31 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ pnpm add @oasisjs/biscuit yarn add @oasisjs/biscuit ``` +get a quick bot: `deno run --allow-net https://crux.land/2CENgN [token]` + The biscuit Discord library is built ontop of Discordeno and webspec APIs, we aim to provide portability. Join our [Discord](https://discord.gg/zmuvzzEFz2) diff --git a/hello.ts b/hello.ts new file mode 100644 index 0000000..aa5aade --- /dev/null +++ b/hello.ts @@ -0,0 +1,18 @@ +// Biscuit Discord library showcase + +import Biscuit, { GatewayIntents } from "https://deno.land/x/biscuit/mod.ts"; + +const intents = GatewayIntents.MessageContent | GatewayIntents.Guilds | GatewayIntents.GuildMessages; +const session = new Biscuit({ token: Deno.args[0], intents }); + +session.on("ready", ({ user }) => { + console.log("Logged in as: %s!\nUse !ping to get a reply", user.username); +}); + +session.on("messageCreate", (message) => { + if (message.content.startsWith("!ping")) { + message.reply({ content: "pong!" }); + } +}); + +session.start();