Skip to content

Commit 4bfba36

Browse files
authored
merge discord.sc
1 parent dea7183 commit 4bfba36

File tree

16 files changed

+865
-0
lines changed

16 files changed

+865
-0
lines changed

discord/disflux/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `disflux`
2+
3+
All Discord-related errors.

discord/readme.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# discord.sc 1.2
2+
3+
An endorsed supcode extension for interacting with the [Discord API](https://discord.com/developers/docs), specifically for creating bots.
4+
5+
6+
## Subextensions
7+
8+
### [`slash`](slash)
9+
Slash commands implementation and functionality.
10+
11+
12+
## Intrinsics
13+
14+
### [`disflux`](disflux)
15+
Discord-specific errors.
16+
17+
18+
## Quick Specimen
19+
Here’s a quick showcase of a simple Discord bot:
20+
21+
```coffee
22+
spec code { ver = 5.6 | syn = utinax | sty = stan }
23+
24+
activate discord { ver = 1.2 }
25+
26+
create discord.bot('demo') [token = discord.token('dQw4w9WgXcQ')] {
27+
create discord.command 'sup' {
28+
define demo.sup(ctx) {
29+
ctx.reply("sup")
30+
}
31+
}
32+
}
33+
34+
demo.start()
35+
```
36+
37+
Many more examples can be found in [specimens](specimens).
38+
39+
40+
## Syntax
41+
discord.sc encourages an object-oriented syntax style, although supports various others too.
42+
43+
Throughout this repository all code blocks will use CoffeeScript syntax highlighting, which is highly flexible and perfect for adding contrast, while not (significantly) disrupting or detracting from any semantics of the code.

discord/slash/readme.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `slash`
2+
3+
A subextension implementing slash command functionality.

discord/slash/structs/option.md

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# `option`
2+
3+
A slash command option.
4+
5+
```coffee
6+
struct 'option' {
7+
str 'name'
8+
str 'description'
9+
type, pool, dict 'options'
10+
var 'default'
11+
bool 'autocomplete'
12+
bool 'required'
13+
14+
num 'min'
15+
num 'max'
16+
}
17+
```
18+
19+
20+
<br>
21+
22+
23+
## Properties
24+
25+
| property | aliases | type | description |
26+
| :------- | :------ | :--- | :---------- |
27+
| `name` | | `str` | The displayed name of the option. |
28+
| `description` | `desc` | `str` | The description of the option. |
29+
| `options` | `choices` | `type`, `pool`, `dict` | The collection of options that can be selected. |
30+
| `default` | | `slot`, variable | The option selected by default. |
31+
| `autocomplete` | `autofill`, `auto` | `bool` | |
32+
| `required` | `req` | `bool` | |
33+
| `min` | | `num` | |
34+
| `max` | | `num` | |
35+
36+
37+
<br>
38+
39+
40+
## Functions
41+
42+
| function | output | description |
43+
| :------- | :----- | :---------- |
44+
| [`create`](create) | [`slash.option`](#option) | Creates a slash option. |
45+
46+
### `create`
47+
Creates a slash option.
48+
49+
```coffee
50+
func[evo] create(ctx) [
51+
| name = default
52+
| description = none
53+
| options = none
54+
| default = none
55+
| autocomplete = false
56+
| required = true
57+
| min = none
58+
| max = none
59+
]
60+
```

discord/source/colour.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# `colour`
2+
3+
A collection of Discord-specific colours.
4+
5+
```coffee
6+
class 'col', 'color', 'colour' {
7+
'blurple' = 0x5865f2
8+
}
9+
```

discord/source/functions/mention.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## `mention`
2+
Mentions a particular Discord component.
3+
4+
```coffee
5+
func 'mention'(object 'target' = none) {
6+
7+
}
8+
```
9+
10+
### Inputs
11+
| input | default | type | description |
12+
| :---- | :------ | :--- | :---------- |
13+
| `object` | `self`
14+
15+
### Example
16+
```coffee
17+
set 'channel' = discord.channel(...)
18+
set 'ping' = discord.mention(discord.user(...))
19+
set 'message' = "sup `ping`, you’re in `mention(channel)`­­"
20+
21+
channel.send(message)
22+
```

discord/source/functions/send.md

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
## `send`
2+
Sends a message to a channel.
3+
4+
```coffee
5+
func discord.channel.send(str 'content' = none) [
6+
| react = none
7+
| stickers = none
8+
| attach = none
9+
| embed = none
10+
| embeds = none
11+
| view = none
12+
| views = none
13+
| delete = 0.0
14+
]
15+
```
16+
17+
### Inputs
18+
| input | aliases | type | description |
19+
| :---- | :------ | :--- | :---------- |
20+
| `react` | `reactions` | [`discord.(emoji)s`](emoji.md) | Reaction(s) to add. |
21+
| `sticker` | `stickers` | [`discord.(sticker)s`](sticker.md) | Sticker(s) to add. |
22+
| `attach` | `attachments` | [`discord.(asset)s`](asset.md) | Attachment(s) to upload. |
23+
| `embed` | `embeds` | [`discord.(embed)s`](embed.md) | Embed(s) to add. |
24+
| `view` | `views` | [`discord.(view)s`](view.md) | View(s) to add. |
25+
| `delete` | `delete_after` | `float`, `datix.time`, `datix.date`, `datix.datetime` | The duration after which to delete the message. |
26+
27+
### Example
28+
```coffee
29+
discord.channel(...).send("sup") [
30+
| attach = sys.file('sup.svg')
31+
| embed = discord.embed() [...] {...}
32+
| view = discord.view() [...] {...}
33+
]
34+
```
35+
36+
<br>
37+
---
38+
<br>
39+
40+
## `reply`
41+
Replies to a message.
42+
43+
```coffee
44+
func discord.message.reply(str 'content' = none) [
45+
| mention = false
46+
| react = none
47+
| stickers = none
48+
| attach = none
49+
| embed = none
50+
| embeds = none
51+
| view = none
52+
| views = none
53+
| delete = 0.0
54+
]
55+
```

discord/source/structs/bot.md

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# `bot`
2+
3+
A Discord bot.
4+
5+
```coffee
6+
struct 'bot' {
7+
discord.id 'token' = none
8+
pool[none | default | all] 'intents' = slot(default)
9+
str 'prefix' = ""
10+
}
11+
```
12+
13+
<br>
14+
15+
# Properties
16+
17+
| property | aliases | type | description |
18+
| :------- | :------ | :--- | :---------- |
19+
| `token` | `key` | `discord.token` | API key of the bot. |
20+
| `intents` | | `slot` | Intents the bot will be subscribed to. |
21+
| `prefix` | `command_prefix` | `(str)s` | Prefix that precedes all commands. |
22+
23+
<br>
24+
25+
# Functions
26+
27+
| function | output | description |
28+
| :------- | :----- | :---------- |
29+
| [`create`](#create) | [`bot`](#bot) | Creates a bot. |
30+
| [`start`](#start) | `none` | Starts the bot. |
31+
32+
33+
## `create`
34+
Creates a bot.
35+
36+
```coffee
37+
evo func create [
38+
| token = none
39+
| intents = default
40+
]
41+
```
42+
43+
### Inputs
44+
| input | aliases | type | description |
45+
| :---- | :------ | :--- | :---------- |
46+
47+
48+
## `start`
49+
Starts the bot.
50+
51+
```coffee
52+
evo func start() []
53+
```

0 commit comments

Comments
 (0)