Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/djobbo/reaccord

Turn your react code into fully featured discord bots!
https://github.com/djobbo/reaccord

discord discord-js nodejs react reactjs

Last synced: 3 months ago
JSON representation

Turn your react code into fully featured discord bots!

Awesome Lists containing this project

README

        


Reaccord Banner















Reaccord is a framework for creating discord bots with [react](https://reactjs.org/).
It is built on top of the [discord.js](https://discord.js.org/) library and is designed to be easy to use.

Explore the docs...

---

Turn your react code into fully featured discord bots **[now](https://reaccord.djobbo.com)**!

## Let's build a simple counter

What we will be building:
Simple Counter
_You can view the complete source code [here](https://github.com/djobbo/reaccord/tree/master/examples/simple-counter)._

**Define your App's behavior**, as you would do in a regular React webapp.

```jsx
const Counter = ({ start = 0 }) => {
const [count, setCount] = useState(start)

return (
<>
{count}
setCount(count + 1)}>+
>
)
}
```

**Create end-user command.**

```jsx
const counterCommand = createSlashCommand("counter", "A simple counter")
.intParam("start", "Number to start counting from")
.render(({ start }) => )
```

**Instantiate the gateway client**, and register the command.

```jsx
const client = createClient({
token: "bot-token",
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
devGuildId: "dev-guild-id",
clientId: "bot-client-id",
commands: [counterCommand],
})
```

**Connect the client to discord's gateway**

```js
client.connect(() =>
console.log(`🚀 Client connected as ${client.user?.username}!`),
)
```

**Congratulations**, now you can go ahead and try your brand new command!

Simple Counter

---


Explore the docs...