This commit also points to my fork of discordgo which makes it look like the official client which is the only way to get the actually contents of a dm when not authorized as a bot.
29 lines
467 B
Go
29 lines
467 B
Go
package database
|
|
|
|
import (
|
|
log "maunium.net/go/maulogger/v2"
|
|
)
|
|
|
|
type PuppetQuery struct {
|
|
db *Database
|
|
log log.Logger
|
|
}
|
|
|
|
func (pq *PuppetQuery) New() *Puppet {
|
|
return &Puppet{
|
|
db: pq.db,
|
|
log: pq.log,
|
|
|
|
EnablePresence: true,
|
|
}
|
|
}
|
|
|
|
func (pq *PuppetQuery) Get(id string) *Puppet {
|
|
row := pq.db.QueryRow("SELECT id, display_name, avatar, avatar_url, enable_presence FROM puppet WHERE id=$1", id)
|
|
if row == nil {
|
|
return nil
|
|
}
|
|
|
|
return pq.New().Scan(row)
|
|
}
|