Skip to content

Commit c319b61

Browse files
authored
Add Command Message Handlers and Components
1 parent 621bbac commit c319b61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+33204
-16590
lines changed

.eslintrc.cjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ module.exports = {
1212
"eqeqeq": ["error", "smart"],
1313
"capitalized-comments": 0,
1414
},
15-
ignorePatterns: ["**/*.js"],
1615
};

.github/workflows/lint.yml

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@ jobs:
1212
uses: actions/setup-node@v2
1313
with:
1414
node-version: 16.2
15-
16-
- name: Cache Dependencies
17-
uses: actions/cache@v2
18-
with:
19-
path: ~/.npm
20-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
21-
restore-keys: |
22-
${{ runner.os }}-node-
15+
cache: npm
2316

2417
- name: Install
2518
env:
2619
CI: true
2720
run: |
28-
npm install
21+
npx lerna bootstrap
22+
23+
- name: Build
24+
run: |
25+
npm run build
2926
3027
- name: Lint
3128
run: |
@@ -40,20 +37,17 @@ jobs:
4037
uses: actions/setup-node@v2
4138
with:
4239
node-version: 16.2
43-
44-
- name: Cache Dependencies
45-
uses: actions/cache@v2
46-
with:
47-
path: ~/.npm
48-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
49-
restore-keys: |
50-
${{ runner.os }}-node-
40+
cache: npm
5141

5242
- name: Install
5343
env:
5444
CI: true
5545
run: |
56-
npm install
46+
npx lerna bootstrap
47+
48+
- name: Build
49+
run: |
50+
npm run build
5751
5852
- name: Formatting
5953
run: |

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# TODO: Figure out auth and figure out how to link to to successful runs of other actions (make sure tests pass)
2+
# name: Publish
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
Publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# - uses: actions/checkout@v2
14+
15+
# - name: Install Node.js 16.x
16+
# uses: actions/setup-node@v2
17+
# with:
18+
# node-version: 16.2
19+
# cache: npm
20+
21+
# - name: Install
22+
# env:
23+
# CI: true
24+
# run: |
25+
# npx lerna bootstrap
26+
27+
# - name: Build
28+
# run: |
29+
# npm run build
30+
31+
- name: Publish
32+
run: echo "Unimplemented"
33+
# run: |
34+
# npx lerna publish from-package --yes

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
Test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
11+
- name: Install Node.js 16.x
12+
uses: actions/setup-node@v2
13+
with:
14+
node-version: 16.2
15+
cache: npm
16+
17+
- name: Install
18+
env:
19+
CI: true
20+
run: |
21+
npx lerna bootstrap
22+
23+
- name: Build
24+
run: |
25+
npm run build
26+
27+
- name: Test
28+
run: |
29+
npm test

.github/workflows/typecheck.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,17 @@ jobs:
1212
uses: actions/setup-node@v2
1313
with:
1414
node-version: 16.2
15-
16-
- name: Cache Dependencies
17-
uses: actions/cache@v2
18-
with:
19-
path: ~/.npm
20-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
21-
restore-keys: |
22-
${{ runner.os }}-node-
15+
cache: npm
2316

2417
- name: Install
2518
env:
2619
CI: true
2720
run: |
28-
npm install
21+
npx lerna bootstrap
22+
23+
- name: Build
24+
run: |
25+
npm run build
2926
3027
- name: Typecheck
3128
run: |

README.md

Lines changed: 11 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,95 +2,24 @@
22

33
🚧 **INTERACTION KIT IS UNDER CONSTRUCTION AND IS NOT READY FOR USE** 🏗
44

5-
Interaction Kit is a framework for creating Discord slash command bots over the HTTP API. TODO: More here.
5+
Interaction Kit is a framework for creating Discord slash command bots over the HTTP API.
66

7+
<!-- ## HTTP vs Gateway
78
8-
## Getting Started
9-
10-
This library is currently in alpha 1 - it's very limited in what it can do and what is documented.
11-
12-
13-
If you would like to help out with the development, you can trial interaction-kit by creating a project that looks like this:
14-
15-
```
16-
application/
17-
├─ src/
18-
│ ├─ commands/
19-
│ │ ├─ ping.js
20-
│ ├─ index.js
21-
├─ .env
22-
├─ package.json
23-
```
9+
In short, you probably should be using [discord.js]() unless you know why you're here.
2410
25-
The files should contain the following:
11+
**Gateway**:
2612
27-
src/commands/ping.js:
28-
```javascript
29-
import { Command } from 'interaction-kit';
13+
**HTTP**:
3014
31-
export default new Command({
32-
name: 'ping',
33-
description: 'Get a pong back',
34-
handler: (interaction) => {
35-
interaction.reply({ message: 'pong', ephemeral: true });
36-
},
37-
});
38-
```
15+
Interaction Kit **does not** interface with the Gateway, which limits information is available to your application (and also means you can never be sure the information you have is up to date - if you request information about a User, and that user then updates their profile, if you are on Gateway you'll get a notification of the update event. With the HTTP API, you would not know the data had been changed).
3916
40-
src/index.js
41-
```javascript
42-
import { Application } from 'interaction-kit';
43-
import PingCommand from './commands/ping.js';
17+
There are other drawbacks as well - HTTP-only bots don't currently show up as Online in a Guild's member list, which will lead to a lot of questions about whether the application is working or not.
4418
45-
export default new Application({
46-
applicationID: process.env.APPLICATION_ID,
47-
publicKey: process.env.PUBLIC_KEY,
48-
token: process.env.TOKEN,
49-
})
50-
.addCommand(PingCommand)
51-
.startServer();
52-
```
53-
54-
package.json
55-
```json
56-
{
57-
"name": "interaction-kit-test",
58-
"version": "0.0.1",
59-
"main": "src/index.js",
60-
"type": "module",
61-
"scripts": {
62-
"start": "node --es-module-specifier-resolution=node src/index.js"
63-
},
64-
"engines": {
65-
"node": ">=14"
66-
},
67-
"dependencies": {
68-
"interaction-kit": "^0.0.1"
69-
}
70-
}
71-
```
72-
73-
.env:
74-
```
75-
APPLICATION_ID=your_id
76-
PUBLIC_KEY=your_key
77-
TOKEN=your_token
78-
DEVELOPMENT_SERVER_ID=your_dev_server
79-
```
80-
81-
Steps:
82-
83-
1. Create a new Discord application and make it a bot user
84-
2. Fill out the `.env` file
85-
3. Add the bot to your server with https://discord.com/oauth2/authorize?client_id=APPLICATION_ID&scope=applications.commands (replace APPLICATION_ID with your application ID)
86-
4. Install Cloudflared for Cloudflare Tunnel: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation
19+
## Getting Started
8720
88-
Then, run the following commands:
21+
## Community
8922
90-
```
91-
npm install
92-
npm start
93-
cloudflared tunnel --url http://localhost:3000
94-
```
23+
## Packages -->
9524

96-
Copy the URL cloudflared gives you into your Interaction Endpoint. You should now be able to use your bot and the `/ping` command!
25+
TODO: Write
File renamed without changes.

lerna.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"packages": [
3+
"packages/*"
4+
],
5+
"version": "independent"
6+
}

0 commit comments

Comments
 (0)