A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
Add images and content to quickstart guide
Hampusc2b69be17d18
diff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..a813adffcBinary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..ea23f8ed9Binary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..870d53ec1Binary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..cf72c42d8Binary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..40e6d2dbbBinary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..e8cffdbe5Binary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..56f05b8cfBinary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..3c9a1bfbcBinary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..c3305bd81Binary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..8ca663ec9Binary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/images/[email protected] b/fluxer_docs/images/[email protected]new file mode 100644index 000000000..d929e529dBinary files /dev/null and b/fluxer_docs/images/[email protected] differdiff --git a/fluxer_docs/quickstart.mdx b/fluxer_docs/quickstart.mdxindex 27b087589..b7e21b857 100644--- a/fluxer_docs/quickstart.mdx+++ b/fluxer_docs/quickstart.mdx@@ -1,6 +1,171 @@----title: 'Quickstart: ping-pong bot'-description: 'Create a bot application, invite it to a guild, and reply "pong" to "ping".'+title: "Quickstart: ping-pong bot"+description: "Create a bot application, invite it to a guild, and reply "pong" to "ping"."----TBD\ No newline at end of file+<Warning>+ A lot of the documentation here is still being written, sorry for the incompleteness! This guide should get you up and running with a bot fairly quickly, though.+</Warning>++So, you're thinking about creating a Fluxer bot, huh? Think no further, for this guide will get you up and running in no time. You'll need a few things to follow this guide through:++- A text/code editor (such as [VS Code](https://code.visualstudio.com/)) or an integrated development environment (IDE)+- Some basic programming skills and familiarity with JavaScript/Node.js+- [Node.js](https://nodejs.org/en) (a recent LTS version is fine) installed on your system+- An account registered at [Fluxer.app](https://web.fluxer.app/register) (though you're not forced to use this instance, of course!)+- A community (referred to as a guild in the API) that you've created++### Step 1: Open "User Settings" in the bottom-left++On mobile web, press "You" in the bottom-right, then the settings icon in the upper-right.++<Frame>+ +</Frame>++### Step 2: Scroll down and open "Applications" in the sidebar++This should work on mobile web devices too!++<Frame>+ +</Frame>++### Step 3: Create a new application++Give it a fancy name. This will be the default username of your application unless changed.++<Frame>+ +</Frame>++### Step 4: Regenerate the bot token++Press the "Regenerate" button for the bot token field, confirm the action, and store the generated value somewhere secure, such as in a password manager.++<Frame>+ +</Frame>++### Step 5: Mark the bot as private (optional)++You might not want anyone to be able to invite your bot if they know its user ID.++<Frame>+ +</Frame>++### Step 6: Generate the bot invite URL++Check "bot" (you don't need any extra permissions for now) and copy the "Authorize URL."++<Frame>+ +</Frame>++Paste the authorization URL in the browser address bar in a new tab and hit enter to add your bot.++### Step 7: Invite the bot to your community++Visiting the URL should bring up a view similar to this one:++<Frame>+ +</Frame>++Choose a community where you have "Manage Community" permissions to continue.++#### Step 8: A wild bot has appeared!++Now it's time to start writing some code to make our awesome application do awesome things.++<Frame>+ +</Frame>++### Step 9: Write the code and run the bot++First, create a new project directory:++```+mkdir fluxer_bot && cd fluxer_bot && npm init -y+```++Second, install the required dependencies:++```+```++Second, store your token from Step 4 in a `.env` file in this folder:++```+FLUXER_BOT_TOKEN=<your token goes here>+```++Third, create a new `bot.mjs` file, looking like so:++```javascript+import {Client, GatewayDispatchEvents} from '@discordjs/core';+import {REST} from '@discordjs/rest';+import {WebSocketManager} from '@discordjs/ws';++const token = process.env['FLUXER_BOT_TOKEN'];+if (!token) {+ throw new Error('You forgot the token!');+}++const rest = new REST({api: 'https://api.fluxer.app', version: '1'}).setToken(token);++const gateway = new WebSocketManager({+ intents: 0,+ rest,+ token,+ version: '1',+});++const client = new Client({rest, gateway});++client.on(GatewayDispatchEvents.MessageCreate, async ({api, data}) => {+ if (data.author.bot) {+ return;+ }++ if (data.content === '!ping') {+ await api.channels.createMessage(data.channel_id, {+ content: 'pong!',+ message_reference: {message_id: data.id},+ });+ }+});++client.on(GatewayDispatchEvents.Ready, ({data}) => {+ const {username, discriminator} = data.user;+ console.log(`Logged in as @${username}#${discriminator}`);+});++gateway.connect();+```++Finally, save this file and run it via `node --env-file=.env bot.mjs`.++```+➜ fluxer_bot node --env-file=.env bot.mjs+Logged in as @My_Awesome_Application#0168+```++<Frame caption="Your bot should now be alive and well!">+ +</Frame>++<Frame caption="Heyo!">+ +</Frame>++<Warning>+ A lot of the documentation here is still being written, sorry for the incompleteness! This guide should get you up and running with a bot fairly quickly, though.\+ \+ Fluxer's HTTP API & Gateway API share similarities with the Discord API to make it easy for you to migrate existing Discord bot libraries. Note that slash commands & interactions are not yet implemented on Fluxer, but they're coming soon!+</Warning>++Hack the planet!\ No newline at end of file