Compare commits
2 Commits
v0.2.4
...
0b39a0996f
Author | SHA1 | Date | |
---|---|---|---|
0b39a0996f | |||
9ffab89ebf
|
@@ -1,6 +1,6 @@
|
||||
# bolt
|
||||
|
||||
Base Discord bot framework
|
||||
Base library for Discord bots
|
||||
|
||||
## Introduction
|
||||
bolt is a wrapper for Discordgo to provide very quick and easy setup for simple Discord bots. The only code required to run bolt are the command handler functions, this provides developers with the ability to have text-based commands on a Discord server without all the bootstrapping and setup usually required. Any strings returned from the Payload function will be sent back to the Discord server as a reply to the command message.
|
||||
|
5
bolt.go
5
bolt.go
@@ -67,6 +67,7 @@ func New(opts ...Option) Bolt {
|
||||
//set default command indicator
|
||||
b.indicator = "."
|
||||
|
||||
//apply options to bolt
|
||||
for _, o := range opts {
|
||||
o(b)
|
||||
}
|
||||
@@ -85,6 +86,7 @@ func (b *bolt) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
//safe shutdown handler
|
||||
sigChannel := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChannel, syscall.SIGINT)
|
||||
<-sigChannel
|
||||
@@ -241,7 +243,8 @@ func (b *bolt) getRemainingTimeout(timeout time.Time) string {
|
||||
// checks if the author of msg has the correct role to run the requested command
|
||||
func (b *bolt) roleCheck(msg *dg.MessageCreate, s *dg.Session, run Command) (bool, error) {
|
||||
var found bool
|
||||
//loop thru author roles
|
||||
//loop thru author roles, there may be a better way to check for this UNION
|
||||
//TODO: improve role search performance to support bigger lists
|
||||
for _, r := range msg.Member.Roles {
|
||||
//get role name from ID
|
||||
n, err := s.State.Role(msg.GuildID, r)
|
||||
|
Reference in New Issue
Block a user