An extension for discordgo to create a Discord bot quickly using the Builder pattern.

botbuilder

CI issues forks stars license Go Go Reference

An extension for discordgo to create a Discord bot quickly using the Builder pattern.

Example usage:

package main

import (
	"log"
	"os"

	"github.com/bwmarrin/discordgo"
	"github.com/taekwonzeus/botbuilder"
)

var (
	// Create a fully tuned command:
	ping = &botbuilder.Command{
		Name:        "ping",
		Description: "Ping!",
		Aliases:     []string{"p"},
		Execute: func(s *discordgo.Session, m *discordgo.MessageCreate, args []string) {
			s.ChannelMessageSend(m.ChannelID, "Pong!")
		},
	}

	// Or a simple one:
	test = botbuilder.SimpleCommand(
		"test",
		func(s *discordgo.Session, m *discordgo.MessageCreate, args []string) {
			s.ChannelMessageSend(m.ChannelID, "test response")
		},
	)

	// You can also set up a channel where all the messages go.
	// Working/freeing it is up to you.
	messageCollector = make(chan *discordgo.MessageCreate)
)

func main() {
	// Create a Discord bot
	dg, err := botbuilder.NewBotBuilder(os.Getenv("DISCORD_TOKEN")).
		AddCommands(ping, test).
		SetMessageCollector(messageCollector).
		Build()
	if err != nil {
		log.Fatal("Error when creating bot: ", err)
	}

	// Open the connection
	err = dg.Open()
	if err != nil {
		log.Fatal("Error opening connection: ", err)
	}

	// Close the connection with dg.Close()
}
Similar Resources

Discord-finder - The back-end for retrieving information about people on discord

Discord-finder - The back-end for retrieving information about people on discord

About This is the backend application for Discord Finder, it allows you to retrive information about people on discord just like the discord lookup we

Jan 4, 2022

Wipe-discord - TUI application to erase Discord messages

Wipe-discord - TUI application to erase Discord messages

wipe-discord Terminal user interface (TUI) application to delete Discord message

Aug 21, 2022

A Discord bot for managing ephemeral roles based upon voice channel member presence.

A Discord bot for managing ephemeral roles based upon voice channel member presence.

ephemeral-roles A Discord bot for managing ephemeral roles based upon voice channel member presence. Quickstart Click on the Ephemeral Roles logo head

Dec 19, 2022

Bot used for https://discord.gg/rflutterdev

FlutterDoc A bot offering exactly what we need in The r/FlutterDev Discord Server that Dyno can't offer us. Quick search patterns that can be embedded

Dec 8, 2022

An easy-to-use discord bot written in go

Discord Bot An easy-to-use discord bot template written in golang using discordgo. This template was written for learning golang. It will be updated a

Jan 23, 2022

Bot para o discord escrito em Golang durante o workshop ministrado na Codecon 2021

Codecon Bot Bot para o discord escrito em Golang durante o workshop ministrado na Codecon 2021 Primeiramente no arquivo main.go coloque o TOKEN do bot

Oct 4, 2021

A discord bot that watches for tiktok URL's and automatically uploads the corresponding video to the channel

TikiTok Bot A Discord bot that watches for TikTok URLs and sends a message to the channel with the corresponding video attached Click to invite the bo

Jul 28, 2022

morko discord bot with go

Commands Command Description commands Lists commands google Fetches a Google image help Describes the usage of the command. ping Ping

Oct 19, 2021

Pulseline Discord bot

Pulseline Discord bot Currently used in the FreeBSD Discord server to relay incoming GitHub web-hook events to a desired channel, showing information

Nov 21, 2022
An easy-to-use discord bot template written in golang using discordgo

Discord Bot An easy-to-use discord bot template written in golang using discordgo. This template was written for learning golang. It will be updated a

Oct 30, 2021
Discord-bot - A Discord bot with golang

JS discord bots Install Clone repo git clone https://github.com/fu-js/discord-bo

Aug 2, 2022
DiscordGo: a Go package that provides low level bindings to the Discord chat client API
DiscordGo: a Go package that provides low level bindings to the Discord chat client API

DiscordGo DiscordGo is a Go package that provides low level bindings to the Discord chat client API. DiscordGo has nearly complete support for all of

Dec 14, 2021
Feline-bot - Feline Bot for Discord using Golang

Feline Bot for Discord Development This bot is implemented using Golang. Feature

Feb 10, 2022
PartsBot 2, written (badly) in Go using discordgo.

PartsBot A bot that fetches information from PCPartPicker directly from Discord. It is currently not being hosted officially. It uses the discordgo AP

Jan 9, 2022
discord bot that plays music in a voice channel discord

Music discord bot by serje3 Description A bot written in the Golang language plays music on your server's voice channel on Discord. It can be built an

Nov 17, 2021
A simple Discord bot developed for the Bedrock Gophers discord server.

Bedrock Gopher A simple Discord bot developed for the Bedrock Gophers discord server. Click here to invite the bot to your guild. You will also need t

Mar 12, 2022
Bot-template - A simple bot template for creating a bot which includes a config, postgresql database

bot-template This is a simple bot template for creating a bot which includes a c

Sep 9, 2022
Discord-dl: a tool to archive discord channels

discord-dl discord-dl is a tool to archive discord channels. I think it's safe t

May 18, 2022
Discord-notif - Send notifications to discord in Your pipelines or scripts
Discord-notif - Send notifications to discord in Your pipelines or scripts

discord-notif Send notifications to discord in Your pipelines or scripts install

Dec 15, 2022