From a7e281d6e0bc27410da92c0855250c44348fbfe9 Mon Sep 17 00:00:00 2001 From: odilon Date: Sat, 18 May 2024 16:31:13 +0200 Subject: [PATCH] Add documentation --- README.md | 11 +++++++++++ discordbot.go | 4 ++-- main.go | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3a651c5..f9d2511 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@
  • GUI
  • Command Line
  • API
  • +
  • Discord
  • Contributing
  • @@ -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 +``` +

    (back to top)

    diff --git a/discordbot.go b/discordbot.go index 0515676..8ff671d 100644 --- a/discordbot.go +++ b/discordbot.go @@ -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", }, } @@ -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) { diff --git a/main.go b/main.go index ce15f7e..e362ac7 100644 --- a/main.go +++ b/main.go @@ -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{