Skip to content

Commit

Permalink
Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tr4cks committed May 18, 2024
1 parent 48cabc4 commit a7e281d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<li><a href="#gui">GUI</a></li>
<li><a href="#command-line">Command Line</a></li>
<li><a href="#api">API</a></li>
<li><a href="#discord">Discord</a></li>
</ul>
</li>
<li><a href="#contributing">Contributing</a></li>
Expand Down Expand Up @@ -355,6 +356,16 @@ Since the `ilo` module simulates the pressing of the power button, regardless of

Concerning the `wol` module, as mentioned earlier, it does not allow you to shut down the server, so the `down` command will have no effect.

### Discord

In addition to the http server, you can also activate a discord bot to switch on the server with a command from discord, simply by adding the following fields to the configuration file:

```yaml
discord:
bot-token: your_bot_token
guild-id: "your_guild_id" # optional
```

<p align="right">(<a href="#readme-top">back to top</a>)</p>


Expand Down
4 changes: 2 additions & 2 deletions discordbot.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (d *DiscordBot) powerOnHandler(s *discordgo.Session, i *discordgo.Interacti

var commands = []*discordgo.ApplicationCommand{
{
Name: "power-on",
Name: "power_on",
Description: "Turns the server on",
},
}
Expand All @@ -162,7 +162,7 @@ func NewDiscordBot(config *DiscordBotConfig, module modules.Module) (*DiscordBot
bot := &DiscordBot{config, module, logger, session, nil}

commandHandlers := map[string]func(*discordgo.Session, *discordgo.InteractionCreate){
"power-on": bot.powerOnHandler,
"power_on": bot.powerOnHandler,
}

session.AddHandler(func(s *discordgo.Session, i *discordgo.InteractionCreate) {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var (
rootCmd = &cobra.Command{
Use: appName,
Short: "All-in-one tool for remote server power control",
Version: "1.2.0",
Version: "1.3.0",
Args: cobra.NoArgs,
Run: run,
CompletionOptions: cobra.CompletionOptions{
Expand Down

0 comments on commit a7e281d

Please sign in to comment.