azure-bot

command module
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 15 Imported by: 0

README

Azure Discord Bot

Tests Release GitHub forks GitHub stars GitHub contributors GitHub license GitHub All Releases Docker Pulls Discord

Supports amd64

Discord Support

Purpose

Enables users in Discord to invoke Start or Stop actions on Azure VMs

Did I save you some time? Buy me a ☕😄

Configure the bot

Modify azure-bot-config.yml as needed.

Each entry in the list has 4 properties

  • logical_name: The name users will call the VM when they invoke $startvm or $stopvm
  • azurevm_name: The name of the VM as shown in Azure
  • resource_group: The resource group where the VM is deployed
  • subscription_id: The subscription id where the VM is deployed

Running the bot

Environment Variables
  • AZURE_BOT_DISCORD_TOKEN
  • AZURE_CLIENT_ID
  • AZURE_CLIENT_SECRET
  • AZURE_TENANT_ID
  • AZURE_SUBSCRIPTION_ID
VSCode

Included is a VSCode devcontainer to help you get off the ground quickly.

Debugger is enabled in devcontainer, provided env variables below are set.

Kubernetes

Take a look at kube-manifest.yml for an idea of what you need to deploy.

Ensure you have secrets & configmaps set.

Example Configmap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: azure-bot-live-config
data:
  config: |
    vms:
      - logical_name: A
        azurevm_name: B
        resource_group: C
        subscription_id: D
Discord Bot Setup
  • This guide seems to have a good write up on how to generate a bot token.
  • Note that during the creation of the bot, you will need to enable the "Server Members Intent" flag on the Bot page in the Discord developers portal.
  • Once you have the token in step 5, replace "9999" in the docker-compose.yml file with your bot's token.
  • Finally, craft your authorization URL. You can copy the authorization URL from the Discord developers portal as mentioned in step 5.
  • Once the authorization URL is copied, replace the permissions integer with that from the URL given above to join the public bot to your server.
  • You should now be able to visit your authorization URL and join your own bot to your Discord guild.

Using the bot

Once the bot is joined, in any channel it has read access to, send a message $help. This command will enumerate all the commands the bot currently supports.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Make changes, and update CHANGELOG.md to describe them.
  4. Commit your changes (git commit -m 'Add some AmazingFeature')
  5. Push to the branch (git push origin feature/AmazingFeature)
  6. Open a pull request

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL