Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
# Welcome to Caesar, the Coorinape Discord Bot
# Coordinape Discord Bot

With Web3 communities proliferating and thriving on Discord, Coordinape is
bringing Circle assignment and Epoch alert functionality to Discord! CO Kong
is developed for the purpose of automating Circle assignment, so you can
spend less time signing up members and more time producing and building.
Bringing Coordinape to Discord.

## Caesar Development
## Setting up a Discord Dev bot

TODO: fill this out

## Bot Development

- Reqs: Have yarn 1.22.19 installed
- Install packages with `yarn`

Start server and backend processs

```
yarn && yarn dev
yarn && yarn serve:dev
```

Expand All @@ -23,24 +30,25 @@ In the generated file `src/app/api/zeus/index.ts`, add the following class

```typescript
class HasuraWebSocket extends WebSocket {
constructor(address: string, protocols: string) {
super(address, protocols, {
headers: {
'authorization': process.env.DISCORD_BOT_AUTHORIZATION_HEADER || 'no_secret',
'x-hasura-role': 'discord-bot',
},
});
}
constructor(address: string, protocols: string) {
super(address, protocols, {
headers: {
authorization:
process.env.DISCORD_BOT_AUTHORIZATION_HEADER || "no_secret",
"x-hasura-role": "discord-bot",
},
});
}
}
```

and then use it as follows inside the `apiSubscription` function

```typescript
const client = createClient({
url: String(options[0]),
webSocketImpl: HasuraWebSocket,
});
const client = createClient({
url: String(options[0]),
webSocketImpl: HasuraWebSocket,
});
```

833507b123dbd7102efb408766abe240d2a4df2b (branch `karelianpie:feat/trigger-discord-epoch-events`)
Expand All @@ -53,10 +61,6 @@ or without subscriptions

`yarn zeus http://localhost:8080/v1/graphql ./src/app/api -n --ts -h=x-hasura-admin-secret:admin-secret`

### LogDNA

LogDNA (now [mezmo.com](https://www.mezmo.com/)) was the service for logging that was implemented originally in the app.

### Sentry

[Sentry](https://sentry.io/) for application monitoring and error tracking
18 changes: 7 additions & 11 deletions docs/INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# Install

This discord bot development is platform agnostic. It can be installed locally on windows or unix systems where the discord is available.

These tools can make development quick and are recommended:

- [git CLI](https://git-scm.com) - version control system
- [nodejs v16.16.0](https://nodejs.org/en/) - js runtime built on chrome's v8 engine
- [n](https://github.com/tj/n) - easily change node versions
- [iterm2](https://iterm2.com/) - enhanced terminal for macOS
- [discord](https://discord.com/) - popular chat application used for gaming and organized communities

## Configuration Setup

Before the bot is ready to run there are a few configuration items that should be done. First few steps can be done following
the [discord.js guide](https://discordjs.guide/#before-you-begin);

### 1. Create environment file

Please create a `.env` with the keys below
Please create a `.env` with the keys copied from .env.example.

For these keys below

```
DISCORD_BOT_TOKEN=<taken from discord bot applciation page>
Expand All @@ -29,6 +21,10 @@ SENTRY_IO_DSN=<taken from sentry.io project settings>

```

you'll need to create bot on the Discord side following the Generate bot token step.

TODO: add more instructions on this step.

### 2. Generate bot token

[https://discordjs.guide/preparations/setting-up-a-bot-application.html](https://discordjs.guide/preparations/setting-up-a-bot-application.html)
Expand Down