-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect guild invite, send help message in DM
- Loading branch information
Showing
18 changed files
with
277 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ fox | |
dockervol/ | ||
*.priv | ||
*.db | ||
*.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
package acl | ||
|
||
import "fmt" | ||
|
||
// RoleRestrictionString returns a user-friendly representation of the role | ||
// restriction | ||
func RoleRestrictionString(r RoleRestriction) string { | ||
var rr string | ||
|
||
switch r { | ||
case Admin: | ||
rr = "🔐 Admin" | ||
rr = "🔐 Admin only" | ||
case Privileged: | ||
rr = "🔒 Admin or DJ" | ||
case Anyone: | ||
rr = "🔓 No restriction" | ||
rr = "🔓 No role restriction" | ||
} | ||
|
||
return rr | ||
} | ||
|
||
// ChannelRestrictionString returns a user-friendly representation of the | ||
// channel restriction | ||
func ChannelRestrictionString(c ChannelRestriction) string { | ||
var cr string | ||
|
||
switch c { | ||
case Music: | ||
cr = "🎶 Music text channel only" | ||
case Anywhere: | ||
cr = "🌍 No restriction" | ||
cr = "🌍 No channel restriction" | ||
} | ||
|
||
return cr | ||
} | ||
|
||
// RestrictionString returns a user-friendly representation of an restriction | ||
// pair | ||
func RestrictionString(c ChannelRestriction, r RoleRestriction) string { | ||
return fmt.Sprintf("%s\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0\u00A0%s", | ||
ChannelRestrictionString(c), RoleRestrictionString(r)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package commands | ||
|
||
import ( | ||
"github.com/bwmarrin/discordgo" | ||
"github.com/rs/zerolog" | ||
|
||
"github.com/Depado/fox/acl" | ||
"github.com/Depado/fox/player" | ||
"github.com/Depado/fox/storage" | ||
) | ||
|
||
type fav struct { | ||
BaseCommand | ||
Storage *storage.StormDB | ||
} | ||
|
||
func (c *fav) Handler(s *discordgo.Session, m *discordgo.Message, args []string) { | ||
if len(args) == 0 { | ||
// Save | ||
} | ||
if len(args) > 0 { | ||
switch args[0] { | ||
case "show", "s": | ||
// Show favlist | ||
case "clear", "c": | ||
// Clear favlist | ||
default: | ||
|
||
} | ||
} | ||
} | ||
|
||
func NewFavCommand(p *player.Players, log zerolog.Logger, storage *storage.StormDB) Command { | ||
cmd := "fav" | ||
return &fav{ | ||
BaseCommand: BaseCommand{ | ||
ChannelRestriction: acl.Anywhere, | ||
RoleRestriction: acl.Anyone, | ||
Options: Options{ | ||
ArgsRequired: false, | ||
DeleteUserMessage: true, | ||
}, | ||
Long: cmd, | ||
Aliases: []string{"f"}, | ||
SubCommands: []SubCommand{ | ||
{Long: "show", Aliases: []string{"s"}, Description: "Send your fav list in DM"}, | ||
{Long: "clear", Aliases: []string{"c"}, Description: "Clear your fav list"}, | ||
}, | ||
Help: Help{ | ||
Usage: cmd, | ||
ShortDesc: "Display or modify your favorite sound list", | ||
Description: "This command allows you to save the currently " + | ||
"playing track to your own favorite list. You can then access " + | ||
"your list using the `show/s` subcommand, or clear it up using " + | ||
"the `clear/c` subcommand.", | ||
Examples: []Example{ | ||
{Command: "fav", Explanation: "Add the currently playing track to your fav list"}, | ||
{Command: "fav show", Explanation: "Send your fav list in DM"}, | ||
{Command: "fav clear", Explanation: "Clear up your fav list"}, | ||
}, | ||
}, | ||
Players: p, | ||
log: log.With().Str("command", cmd).Logger(), | ||
}, | ||
Storage: storage, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.