Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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!
- Host: GitHub
- URL: https://github.com/djobbo/reaccord
- Owner: djobbo
- Created: 2022-03-06T18:04:53.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-25T15:34:33.000Z (9 months ago)
- Last Synced: 2024-10-11T11:30:36.458Z (4 months ago)
- Topics: discord, discord-js, nodejs, react, reactjs
- Language: TypeScript
- Homepage: https://reaccord.djobbo.com
- Size: 4.47 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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.---
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:
_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!
---