-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dea7183
commit 4bfba36
Showing
16 changed files
with
865 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `disflux` | ||
|
||
All Discord-related errors. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# discord.sc 1.2 | ||
|
||
An endorsed supcode extension for interacting with the [Discord API](https://discord.com/developers/docs), specifically for creating bots. | ||
|
||
|
||
## Subextensions | ||
|
||
### [`slash`](slash) | ||
Slash commands implementation and functionality. | ||
|
||
|
||
## Intrinsics | ||
|
||
### [`disflux`](disflux) | ||
Discord-specific errors. | ||
|
||
|
||
## Quick Specimen | ||
Here’s a quick showcase of a simple Discord bot: | ||
|
||
```coffee | ||
spec code { ver = 5.6 | syn = utinax | sty = stan } | ||
|
||
activate discord { ver = 1.2 } | ||
|
||
create discord.bot('demo') [token = discord.token('dQw4w9WgXcQ')] { | ||
create discord.command 'sup' { | ||
define demo.sup(ctx) { | ||
ctx.reply("sup") | ||
} | ||
} | ||
} | ||
|
||
demo.start() | ||
``` | ||
|
||
Many more examples can be found in [specimens](specimens). | ||
|
||
|
||
## Syntax | ||
discord.sc encourages an object-oriented syntax style, although supports various others too. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `slash` | ||
|
||
A subextension implementing slash command functionality. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# `option` | ||
|
||
A slash command option. | ||
|
||
```coffee | ||
struct 'option' { | ||
str 'name' | ||
str 'description' | ||
type, pool, dict 'options' | ||
var 'default' | ||
bool 'autocomplete' | ||
bool 'required' | ||
|
||
num 'min' | ||
num 'max' | ||
} | ||
``` | ||
|
||
|
||
<br> | ||
|
||
|
||
## Properties | ||
|
||
| property | aliases | type | description | | ||
| :------- | :------ | :--- | :---------- | | ||
| `name` | | `str` | The displayed name of the option. | | ||
| `description` | `desc` | `str` | The description of the option. | | ||
| `options` | `choices` | `type`, `pool`, `dict` | The collection of options that can be selected. | | ||
| `default` | | `slot`, variable | The option selected by default. | | ||
| `autocomplete` | `autofill`, `auto` | `bool` | | | ||
| `required` | `req` | `bool` | | | ||
| `min` | | `num` | | | ||
| `max` | | `num` | | | ||
|
||
|
||
<br> | ||
|
||
|
||
## Functions | ||
|
||
| function | output | description | | ||
| :------- | :----- | :---------- | | ||
| [`create`](create) | [`slash.option`](#option) | Creates a slash option. | | ||
|
||
### `create` | ||
Creates a slash option. | ||
|
||
```coffee | ||
func[evo] create(ctx) [ | ||
| name = default | ||
| description = none | ||
| options = none | ||
| default = none | ||
| autocomplete = false | ||
| required = true | ||
| min = none | ||
| max = none | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# `colour` | ||
|
||
A collection of Discord-specific colours. | ||
|
||
```coffee | ||
class 'col', 'color', 'colour' { | ||
'blurple' = 0x5865f2 | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
## `mention` | ||
Mentions a particular Discord component. | ||
|
||
```coffee | ||
func 'mention'(object 'target' = none) { | ||
|
||
} | ||
``` | ||
|
||
### Inputs | ||
| input | default | type | description | | ||
| :---- | :------ | :--- | :---------- | | ||
| `object` | `self` | ||
|
||
### Example | ||
```coffee | ||
set 'channel' = discord.channel(...) | ||
set 'ping' = discord.mention(discord.user(...)) | ||
set 'message' = "sup `ping`, you’re in `mention(channel)`" | ||
|
||
channel.send(message) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
## `send` | ||
Sends a message to a channel. | ||
|
||
```coffee | ||
func discord.channel.send(str 'content' = none) [ | ||
| react = none | ||
| stickers = none | ||
| attach = none | ||
| embed = none | ||
| embeds = none | ||
| view = none | ||
| views = none | ||
| delete = 0.0 | ||
] | ||
``` | ||
|
||
### Inputs | ||
| input | aliases | type | description | | ||
| :---- | :------ | :--- | :---------- | | ||
| `react` | `reactions` | [`discord.(emoji)s`](emoji.md) | Reaction(s) to add. | | ||
| `sticker` | `stickers` | [`discord.(sticker)s`](sticker.md) | Sticker(s) to add. | | ||
| `attach` | `attachments` | [`discord.(asset)s`](asset.md) | Attachment(s) to upload. | | ||
| `embed` | `embeds` | [`discord.(embed)s`](embed.md) | Embed(s) to add. | | ||
| `view` | `views` | [`discord.(view)s`](view.md) | View(s) to add. | | ||
| `delete` | `delete_after` | `float`, `datix.time`, `datix.date`, `datix.datetime` | The duration after which to delete the message. | | ||
|
||
### Example | ||
```coffee | ||
discord.channel(...).send("sup") [ | ||
| attach = sys.file('sup.svg') | ||
| embed = discord.embed() [...] {...} | ||
| view = discord.view() [...] {...} | ||
] | ||
``` | ||
|
||
<br> | ||
--- | ||
<br> | ||
|
||
## `reply` | ||
Replies to a message. | ||
|
||
```coffee | ||
func discord.message.reply(str 'content' = none) [ | ||
| mention = false | ||
| react = none | ||
| stickers = none | ||
| attach = none | ||
| embed = none | ||
| embeds = none | ||
| view = none | ||
| views = none | ||
| delete = 0.0 | ||
] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# `bot` | ||
|
||
A Discord bot. | ||
|
||
```coffee | ||
struct 'bot' { | ||
discord.id 'token' = none | ||
pool[none | default | all] 'intents' = slot(default) | ||
str 'prefix' = "" | ||
} | ||
``` | ||
|
||
<br> | ||
|
||
# Properties | ||
|
||
| property | aliases | type | description | | ||
| :------- | :------ | :--- | :---------- | | ||
| `token` | `key` | `discord.token` | API key of the bot. | | ||
| `intents` | | `slot` | Intents the bot will be subscribed to. | | ||
| `prefix` | `command_prefix` | `(str)s` | Prefix that precedes all commands. | | ||
|
||
<br> | ||
|
||
# Functions | ||
|
||
| function | output | description | | ||
| :------- | :----- | :---------- | | ||
| [`create`](#create) | [`bot`](#bot) | Creates a bot. | | ||
| [`start`](#start) | `none` | Starts the bot. | | ||
|
||
|
||
## `create` | ||
Creates a bot. | ||
|
||
```coffee | ||
evo func create [ | ||
| token = none | ||
| intents = default | ||
] | ||
``` | ||
|
||
### Inputs | ||
| input | aliases | type | description | | ||
| :---- | :------ | :--- | :---------- | | ||
|
||
|
||
## `start` | ||
Starts the bot. | ||
|
||
```coffee | ||
evo func start() [] | ||
``` |
Oops, something went wrong.