mirror of https://github.com/velour/catbase.git
Compare commits
No commits in common. "2395f7b33d46dcf1f7bc4a82274f2d3d8714a92a" and "07c4950b2df3ad7938d54a51120043029dc7f75b" have entirely different histories.
2395f7b33d
...
07c4950b2d
|
@ -15,7 +15,6 @@ import (
|
||||||
|
|
||||||
"github.com/jmoiron/sqlx"
|
"github.com/jmoiron/sqlx"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
|
||||||
"github.com/velour/catbase/bot"
|
"github.com/velour/catbase/bot"
|
||||||
"github.com/velour/catbase/bot/msg"
|
"github.com/velour/catbase/bot/msg"
|
||||||
"github.com/velour/catbase/plugins/counter"
|
"github.com/velour/catbase/plugins/counter"
|
||||||
|
@ -28,8 +27,6 @@ const itemName = ":beer:"
|
||||||
type BeersPlugin struct {
|
type BeersPlugin struct {
|
||||||
Bot bot.Bot
|
Bot bot.Bot
|
||||||
db *sqlx.DB
|
db *sqlx.DB
|
||||||
|
|
||||||
untapdCache map[int]bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type untappdUser struct {
|
type untappdUser struct {
|
||||||
|
@ -54,8 +51,6 @@ func New(b bot.Bot) *BeersPlugin {
|
||||||
p := &BeersPlugin{
|
p := &BeersPlugin{
|
||||||
Bot: b,
|
Bot: b,
|
||||||
db: b.DB(),
|
db: b.DB(),
|
||||||
|
|
||||||
untapdCache: make(map[int]bool),
|
|
||||||
}
|
}
|
||||||
for _, channel := range b.Config().GetArray("Untappd.Channels", []string{}) {
|
for _, channel := range b.Config().GetArray("Untappd.Channels", []string{}) {
|
||||||
go p.untappdLoop(b.DefaultConnector(), channel)
|
go p.untappdLoop(b.DefaultConnector(), channel)
|
||||||
|
@ -445,14 +440,6 @@ func (p *BeersPlugin) checkUntappd(c bot.Connector, channel string) {
|
||||||
URL: checkin.Media.Items[0].Photo.Photo_img_lg,
|
URL: checkin.Media.Items[0].Photo.Photo_img_lg,
|
||||||
AltTxt: "Here's a photo",
|
AltTxt: "Here's a photo",
|
||||||
})
|
})
|
||||||
} else if !p.untapdCache[checkin.Checkin_id] {
|
|
||||||
// Mark checkin as "seen" but not complete, continue to next checkin
|
|
||||||
log.Debug().Msgf("Deferring checkin: %#v", checkin)
|
|
||||||
p.untapdCache[checkin.Checkin_id] = true
|
|
||||||
continue
|
|
||||||
} else {
|
|
||||||
// We've seen this checkin, so unmark and accept that there's no media
|
|
||||||
delete(p.untapdCache, checkin.Checkin_id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
user.lastCheckin = checkin.Checkin_id
|
user.lastCheckin = checkin.Checkin_id
|
||||||
|
|
|
@ -74,9 +74,10 @@ func (p *MemePlugin) help(c bot.Connector, kind bot.Kind, message msg.Message, a
|
||||||
formats := p.c.GetMap("meme.memes", defaultFormats)
|
formats := p.c.GetMap("meme.memes", defaultFormats)
|
||||||
msg := "Use `/meme [format] [text]` to create a meme.\nI know the following formats:"
|
msg := "Use `/meme [format] [text]` to create a meme.\nI know the following formats:"
|
||||||
msg += "\n`[format]` can be a URL"
|
msg += "\n`[format]` can be a URL"
|
||||||
msg += fmt.Sprintf("\nor a format from the list of %d pre-made memes listed on the website", len(formats))
|
for k := range formats {
|
||||||
msg += fmt.Sprintf("\nHead over to %s/meme to view and add new meme formats", webRoot)
|
msg += "\n" + k
|
||||||
msg += "\nYou can use `_` as a placeholder for empty text and a newline to separate top vs bottom."
|
}
|
||||||
|
msg += fmt.Sprintf("\nHead over to %s/meme to add new meme formats", webRoot)
|
||||||
p.bot.Send(c, bot.Message, message.Channel, msg)
|
p.bot.Send(c, bot.Message, message.Channel, msg)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -201,12 +202,6 @@ func (p *MemePlugin) slashMeme(c bot.Connector) http.HandlerFunc {
|
||||||
top, bottom = parts[0], parts[1]
|
top, bottom = parts[0], parts[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
if top == "_" {
|
|
||||||
message = bottom
|
|
||||||
} else if bottom == "_" {
|
|
||||||
message = top
|
|
||||||
}
|
|
||||||
|
|
||||||
id, err := p.genMeme(format, top, bottom)
|
id, err := p.genMeme(format, top, bottom)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg := fmt.Sprintf("Hey %s, I couldn't download that image you asked for.", from)
|
msg := fmt.Sprintf("Hey %s, I couldn't download that image you asked for.", from)
|
||||||
|
@ -331,13 +326,6 @@ func (p *MemePlugin) genMeme(meme, top, bottom string) (string, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if top == "_" {
|
|
||||||
top = ""
|
|
||||||
}
|
|
||||||
if bottom == "_" {
|
|
||||||
bottom = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply black stroke
|
// Apply black stroke
|
||||||
m.SetHexColor("#000")
|
m.SetHexColor("#000")
|
||||||
strokeSize := 6
|
strokeSize := 6
|
||||||
|
|
|
@ -39,10 +39,10 @@ var memeIndex = `
|
||||||
<b-container>
|
<b-container>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col cols="5">
|
<b-col cols="5">
|
||||||
<b-input placeholder="Name..." v-model="name"></b-input>
|
<b-input v-model="name"></b-input>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col cols="5">
|
<b-col cols="5">
|
||||||
<b-input placeholder="URL..." v-model="url"></b-input>
|
<b-input v-model="url"></b-input>
|
||||||
</b-col>
|
</b-col>
|
||||||
<b-col cols="2">
|
<b-col cols="2">
|
||||||
<b-button type="submit">Add Meme</b-button>
|
<b-button type="submit">Add Meme</b-button>
|
||||||
|
|
Loading…
Reference in New Issue