Add README.md to all examples (#1236)

* feat(examples/*): add readme

Add README.md to all examples.

* fix(examples): logo image link

* fix(examples): add fixed width to logo

* feat(examples): add titles

* fix(examples/*): make logo smaller

Make DiscordGo logo smaller to match description and title in size.

* fix(examples/avatar): correct avatar url

Use correct logo URL in avatar URL image example.

* fix(examples/slash_commands): wording

Fix wording of "step-by-step tutorial" note.
This commit is contained in:
Fedor Lapshin 2022-11-09 22:19:23 +03:00 committed by GitHub
parent fb0566fac2
commit 4ba7062176
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 367 additions and 6 deletions

View file

@ -1,4 +1,4 @@
<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png">
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Airhorn Example

View file

@ -0,0 +1,39 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Auto Moderation Example
This example demonstrates how to utilize DiscordGo to manage auto moderation
rules and triggers.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the auto_moderation example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of auto_moderation:
-channel string
ID of the testing channel
-guild string
ID of the testing guild
-token string
Bot authorization token
```
The below example shows how to start the bot from the auto_moderation example folder.
```sh
./auto_moderation -channel YOUR_TESTING_CHANNEL -guild YOUR_TESTING_GUILD -token YOUR_BOT_TOKEN
```

View file

@ -0,0 +1,41 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Slash Command Autocomplete Option Example
This example demonstrates how to utilize DiscordGo to create and use
autocomplete options in Slash Commands. As this example uses interactions,
slash commands and slash command options, it is recommended to read
`slash_commands` example before proceeding.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the autocomplete example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of autocomplete:
-guild string
Test guild ID. If not passed - bot registers commands globally
-rmcmd
Whether to remove all commands after shutting down (default true)
-token string
Bot access token
```
The below example shows how to start the bot from the autocomplete example folder.
```sh
./autocomplete -guild YOUR_TESTING_GUILD -token YOUR_BOT_TOKEN
```

View file

@ -1,4 +1,4 @@
<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png">
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Avatar Example
@ -45,5 +45,5 @@ The below example shows how to set your Avatar from a local file.
The below example shows how to set your Avatar from a URL.
```sh
./avatar -t TOKEN -u http://bwmarrin.github.io/discordgo/img/discordgo.png
./avatar -t TOKEN -u https://raw.githubusercontent.com/bwmarrin/discordgo/master/docs/img/discordgo.svg
```

View file

@ -0,0 +1,40 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Components Example
This example demonstrates how to utilize DiscordGo to create and use message
components, such as buttons and select menus. For usage of the text input
component and modals, please refer to the `modals` example.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the components example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of components:
-app string
Application ID
-guild string
Test guild ID
-token string
Bot access token
```
The below example shows how to start the bot from the components example folder.
```sh
./components -app YOUR_APPLICATION_ID -guild YOUR_TESTING_GUILD -token YOUR_BOT_TOKEN
```

View file

@ -0,0 +1,43 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Context Menu Commands Example
This example demonstrates how to utilize DiscordGo to create and use context
menu commands. This example heavily relies on `slash_commands` example in
command handling and registration, therefore it is recommended to be read
before proceeding.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the context_menus example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of context_menus:
-app string
Application ID
-cleanup
Cleanup of commands (default true)
-guild string
Test guild ID
-token string
Bot access token
```
The below example shows how to start the bot from the context_menus example folder.
```sh
./context_menus -app YOUR_APPLICATION_ID -guild YOUR_TESTING_GUILD -token YOUR_BOT_TOKEN
```

View file

@ -1,4 +1,4 @@
<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png">
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Direct Message Ping Pong Example

45
examples/modals/README.md Normal file
View file

@ -0,0 +1,45 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Modals Example
This example demonstrates how to utilize DiscordGo to send and process text
inputs in modals. If you have not read `slash_commands` and `components`
examples yet it is recommended to do so before proceesing. As this example
is built using interactions and Slash Commands.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the modals example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of modals:
-app string
Application ID
-cleanup
Cleanup of commands (default true)
-guild string
Test guild ID
-results string
Channel where send survey results to
-token string
Bot access token
```
The below example shows how to start the bot from the modals example folder.
```sh
./modals -app YOUR_APPLICATION_ID -guild YOUR_TESTING_GUILD -results YOUR_TESTING_CHANNEL -token YOUR_BOT_TOKEN
```

View file

@ -1,4 +1,4 @@
<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png">
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Ping Pong Example

View file

@ -0,0 +1,39 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Scheduled Events Example
This example demonstrates how to utilize DiscordGo to manage scheduled events
in a guild.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the scheduled_events example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of scheduled_events:
-guild string
Test guild ID
-token string
Bot token
-voice string
Test voice channel ID
```
The below example shows how to start the bot from the scheduled_events example folder.
```sh
./scheduled_events -guild YOUR_TESTING_GUILD -token YOUR_BOT_TOKEN -voice YOUR_TESTING_CHANNEL
```

View file

@ -0,0 +1,41 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Slash Commands Example
This example demonstrates how to utilize DiscordGo to create a Slash Command based bot,
which would be able to listen and respond to interactions. This example covers all aspects
of slash command interactions: options, choices, responses and followup messages.
To avoid confusion, this example is more of a **step-by-step tutorial**, than a demonstration bot.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the slash_commands example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of slash_commands:
-guild string
Test guild ID. If not passed - bot registers commands globally
-rmcmd
Whether to remove all commands after shutting down (default true)
-token string
Bot access token
```
The below example shows how to start the bot from the slash_commands example folder.
```sh
./slash_commands -guild YOUR_TESTING_GUILD -token YOUR_BOT_TOKEN
```

View file

@ -0,0 +1,39 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Stage Instance Example
This example demonstrates how to utilize DiscordGo to manage stage instances.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the stage_instance example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of stage_instance:
-guild string
Test guild ID
-stage string
Test stage channel ID
-token string
Bot token
```
The below example shows how to start the bot from the stage_instance example folder.
```sh
./stage_instance -guild YOUR_TESTING_GUILD -stage STAGE_CHANNEL_ID -token YOUR_BOT_TOKEN
```
```

View file

@ -0,0 +1,34 @@
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Threads Example
This example demonstrates how to utilize DiscordGo to manage channel threads.
**Join [Discord Gophers](https://discord.gg/0f1SbxBZjYoCtNPP)
Discord chat channel for support.**
### Build
This assumes you already have a working Go environment setup and that
DiscordGo is correctly installed on your system.
From within the threads example folder, run the below command to compile the
example.
```sh
go build
```
### Usage
```
Usage of threads:
-token string
Bot token
```
The below example shows how to start the bot from the threads example folder.
```sh
./threads -token YOUR_BOT_TOKEN
```

View file

@ -1,4 +1,4 @@
<img align="right" src="http://bwmarrin.github.io/discordgo/img/discordgo.png">
<img align="right" alt="DiscordGo logo" src="/docs/img/discordgo.svg" width="200">
## DiscordGo Voice Receive Example