Skip to content

Commit

Permalink
Merge pull request #36 from voldyman/update-go-mod
Browse files Browse the repository at this point in the history
Updated dependencies
  • Loading branch information
iopred committed Jan 31, 2022
2 parents e0fecce + f3648cc commit a6739bc
Show file tree
Hide file tree
Showing 9 changed files with 681 additions and 81 deletions.
7 changes: 1 addition & 6 deletions chartplugin/chartplugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,9 @@ func (p *chartPlugin) messageFunc(bot *bruxism.Bot, service bruxism.Service, mes
return
}

pl, err := plot.New()
if err != nil {
service.SendMessage(message.Channel(), fmt.Sprintf("Error making chart, sorry! eg: %s", p.randomChart(service)))
return
}

service.Typing(message.Channel())

pl := plot.New()
pl.Y.Label.Text = axes[0]
pl.X.Label.Text = axes[1]

Expand Down
25 changes: 12 additions & 13 deletions discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ func (m *DiscordMessage) AttachmentURL() string {
if a.ProxyURL != "" {
if a.Width != 0 && a.Height != 0 {
height := 100
width := height * a.Width/a.Height
width := height * a.Width / a.Height
if width > 200 {
width = 200
height = width * a.Height/a.Width
height = width * a.Height / a.Width
}
return fmt.Sprintf("%s?width=%d&height=%d", a.ProxyURL, width, height)
}
Expand All @@ -136,7 +136,7 @@ func (m *DiscordMessage) AttachmentURLLarge() string {

func (m *DiscordMessage) getParsedCommand(prefix string) (parsedCommand *ParsedCommand) {
prefix = strings.ToLower(prefix)

m.Lock()
defer m.Unlock()

Expand All @@ -151,7 +151,7 @@ func (m *DiscordMessage) getParsedCommand(prefix string) (parsedCommand *ParsedC

parsedCommand = &ParsedCommand{}
m.parsedCommands[prefix] = parsedCommand

trimmedPrefix := strings.ToLower(strings.TrimSpace(prefix))
messageLower := strings.ToLower(strings.TrimSpace(m.Message()))
if !strings.HasPrefix(messageLower, trimmedPrefix) {
Expand All @@ -164,9 +164,9 @@ func (m *DiscordMessage) getParsedCommand(prefix string) (parsedCommand *ParsedC
return
}

if len(trimmedPrefix) != len(prefix) {
if len(trimmedPrefix) != len(prefix) {
if len(parts) > 1 {
parts = parts[1:]
parts = parts[1:]
}
} else {
parts[0] = parts[0][len(prefix):]
Expand Down Expand Up @@ -250,7 +250,7 @@ func (d *Discord) replaceRoleNames(message *discordgo.Message, content string) s
}

func (d *Discord) onMessageCreate(s *discordgo.Session, message *discordgo.MessageCreate) {
if (message.Author != nil && message.Author.Bot) {
if message.Author != nil && message.Author.Bot {
return
}

Expand All @@ -265,7 +265,7 @@ func (d *Discord) onMessageCreate(s *discordgo.Session, message *discordgo.Messa
}

func (d *Discord) onMessageUpdate(s *discordgo.Session, message *discordgo.MessageUpdate) {
if (message.Author != nil && message.Author.Bot) {
if message.Author != nil && message.Author.Bot {
return
}

Expand Down Expand Up @@ -552,7 +552,7 @@ func (d *Discord) Guilds() []*discordgo.Guild {
return guilds
}

func (d *Discord) MessagePermissions(message Message) (apermissions int, err error) {
func (d *Discord) MessagePermissions(message Message) (apermissions int64, err error) {
m, ok := message.(*DiscordMessage)
if !ok {
return 0, errors.New("invalid message")
Expand All @@ -566,7 +566,7 @@ func (d *Discord) MessagePermissions(message Message) (apermissions int, err err
return d.UserChannelPermissions(message.UserID(), message.Channel())
}

func (d *Discord) UserChannelPermissions(userID, channelID string) (apermissions int, err error) {
func (d *Discord) UserChannelPermissions(userID, channelID string) (apermissions int64, err error) {
for _, s := range d.Sessions {
apermissions, err = s.State.UserChannelPermissions(userID, channelID)
if err == nil {
Expand All @@ -587,7 +587,7 @@ func (d *Discord) MessageColor(message Message) int {
return color
}
}
return 0
return 0
}

func (d *Discord) UserColor(userID, channelID string) int {
Expand Down Expand Up @@ -625,7 +625,6 @@ func (d *Discord) NicknameForID(userID, userName, channelID string) string {
return m.Nick
}
return m.User.Username
break
}
}
}
Expand All @@ -635,7 +634,7 @@ func (d *Discord) NicknameForID(userID, userName, channelID string) string {

func (d *Discord) UpdateStatus(idle int, game string) {
for _, s := range d.Sessions {
s.UpdateStatus(idle, game)
s.UpdateGameStatus(idle, game)
}
}
func (d *Discord) UpdateStreamingStatus(idle int, game string, url string) {
Expand Down
25 changes: 19 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
module github.com/iopred/bruxism

require (
github.com/atotto/clipboard v0.1.2
github.com/bwmarrin/discordgo v0.22.0
cloud.google.com/go/compute v1.1.0 // indirect
github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect
github.com/atotto/clipboard v0.1.4
github.com/bwmarrin/discordgo v0.23.2
github.com/dustin/go-humanize v1.0.0
github.com/fluffle/goirc v1.0.2
github.com/fluffle/goirc v1.1.1
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/iopred/comicgen v0.0.0-20201007025231-1d7f3d63a039
github.com/lithammer/fuzzysearch v1.1.3
github.com/nlopes/slack v0.6.0
golang.org/x/oauth2 v0.0.0-20191122200657-5d9234df094c
gonum.org/v1/plot v0.0.0-20191107103940-ca91d9d40d0a
google.golang.org/api v0.14.0
golang.org/x/crypto v0.0.0-20220128200615-198e4374d7ed // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
gonum.org/v1/netlib v0.0.0-20210927171344-7274ea1d1842 // indirect
gonum.org/v1/plot v0.10.0
google.golang.org/api v0.66.0
google.golang.org/genproto v0.0.0-20220126215142-9970aeb2e350 // indirect
google.golang.org/grpc v1.44.0 // indirect
)

go 1.14

0 comments on commit a6739bc

Please sign in to comment.