discordbot

module
v0.0.0-...-d0af5f0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT

README

Discord Bot

Discord Bot is a modular boilerplate for a simple command-based discord bot that I have open-sourced from my private use.

Example Commmand

Features

Discord Bot is:

  • Modular (easy to implement and remove "modules" or commands)
  • Adjustable prefix
  • Containerized (provided Dockerfile)

Installation

go mod download

How To Run

Create a .env file in the root directory which contains your Bot Token and optionally, a prefix

Default Webhook Embed formatting can be edited in the pkg/helpers package.

Run it in:

  • A Container
  • go run cmd/main.go

Adding New Modules

New modular modules can be created and binded to a specific command.

Creating the module

Create a <module>.go file in pkg/modules for your new module. It must fulfill the Modules interface defined in pkg/modules/modules.go.

Note: Modules are acted only upon by text commands. For custom handlers, see below.

Registering the module

Register the module in main.go as long as the new module struct satisfies the Modules interface.

Custom Handlers

Custom Handlers can be added to the bot in cmd/main.go via the AddHandler() method which is a wrapper for bwmarrin's discordgo implementation.

AddHandler documentation

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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