A PowerShell Discord bot that can be used to run PowerShell commands and scripts.
For a more simple bot in 1 file, you can browse this previous commit: https://github.com/1-chris/Powershell-Discord-Bot/tree/67d04b6e9854ccb84fabfaacfadc542be13e52ae
- Tested with PowerShell 7.x
- Created with Linux in mind so some included commands/scripts will need adjusting for Windows
- Ensure you've got a Discord bot token and invite the bot to your server.
- Configure variables within the variables.ps1 file.
- Where to run the bot:
- I recommend running this on a Linux server or container.
- It is possible to run this within Azure Functions or within the Azure App Service -- Note: Using ASP you'll find it won't work on Free Linux tier since it doesn't support 64bit PowerShell 7.x)
./Invoke-DiscordBot.ps1
- Enables a script which listens on bot command prefix for the bot to respond to
- Disables a script which listens on bot command prefix for the bot to respond to
- Enables a script which runs against any message sent to a channel the bot is in
- Disables a script which runs against any message sent to a channel the bot is in
- Responds with a greeting. This is included as very basic example of how to create a command.
- You can find the included scripts in the Logic and Unprefixed folder.
These scripts are run when a message is sent to a channel the bot is in and the message starts with the prefix defined in the variables.ps1 file.
- Searches for an anime using AniList API and returns the first result.
- IP information lookup using ipinfo.io and DNS record lookup
- Runs PowerShell commands and returns the output.
- Supports saving commands as custom scripts for later use.
- These commands are locked down to the owner of the bot.
These scripts are run when a message is sent to a channel the bot is in and the message does not start with the prefix defined in the variables.ps1 file.
- Supports using a channel as a shell.
- Customize access to the shell with the variables.ps1 file.
- These commands are locked down to the owner of the bot.