Skip to content
This repository was archived by the owner on May 15, 2021. It is now read-only.

Commit 3862b31

Browse files
committed
initial migration from reason-tools
1 parent 2ec1315 commit 3862b31

File tree

5 files changed

+66
-1
lines changed

5 files changed

+66
-1
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
lib/
2+
node_modules/
3+
.merlin
4+
.DS_Store
5+
npm-debug.log

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# bs-discord.js
2-
BuckleScript bindings for discord.js
2+
BuckleScript bindings for [discord.js](https://www.npmjs.com/package/discord.js)

bsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name" : "discord",
3+
"sources" : ["src"],
4+
}

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "bs-discord.js",
3+
"version": "0.0.1",
4+
"description": "BuckleScript bindings for discord.js",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/BuckleTypes/bs-discord.js.git"
12+
},
13+
"keywords": [
14+
"discord",
15+
"discord.js",
16+
"bucklescript"
17+
],
18+
"author": "",
19+
"license": "ISC",
20+
"bugs": {
21+
"url": "https://github.com/BuckleTypes/bs-discord.js/issues"
22+
},
23+
"homepage": "https://github.com/BuckleTypes/bs-discord.js#readme",
24+
"dependencies": {
25+
"discord.js": "^11.0.0"
26+
}
27+
}

src/discord.re

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
type client;
2+
3+
type message;
4+
5+
type user;
6+
7+
type channel;
8+
9+
external createClient : unit => client = "Client" [@@bs.module "discord.js"] [@@bs.new];
10+
11+
external login : client => string => unit = "" [@@bs.send];
12+
13+
external onReady : client => _ [@bs.as "ready"] => (unit => unit) => unit = "on" [@@bs.send];
14+
15+
external onMessage : client => _ [@bs.as "message"] => (message => unit) => unit =
16+
"on" [@@bs.send];
17+
18+
external getContent : message => string = "content" [@@bs.get];
19+
20+
external getChannel : message => channel = "channel" [@@bs.get];
21+
22+
external getType : channel => string = "type" [@@bs.get];
23+
24+
external getAuthor : message => option user =
25+
"author" [@@bs.get] [@@bs.return null_undefined_to_opt];
26+
27+
external isBot : user => bool = "bot" [@@bs.get];
28+
29+
external reply : message => string => unit = "" [@@bs.send];

0 commit comments

Comments
 (0)