@ -9,6 +9,7 @@ import (
"net/url"
"net/url"
"os"
"os"
"os/signal"
"os/signal"
"path/filepath"
"strings"
"strings"
"syscall"
"syscall"
"time"
"time"
@ -33,6 +34,8 @@ var (
lastPM = make ( map [ string ] time . Time )
lastPM = make ( map [ string ] time . Time )
introMsg = make ( map [ string ] string )
introMsg = make ( map [ string ] string )
quotes = [ ] string { "The hardest choices require the strongest wills." , "You're strong, but I could snap my fingers and you'd all cease to exist." , "Fun isn't something one considers when balancing the universe. But this... does put a smile on my face." , "Perfectly balanced, as all things should be." , "I am inevitable." }
quotes = [ ] string { "The hardest choices require the strongest wills." , "You're strong, but I could snap my fingers and you'd all cease to exist." , "Fun isn't something one considers when balancing the universe. But this... does put a smile on my face." , "Perfectly balanced, as all things should be." , "I am inevitable." }
version = "2.6"
gitCommit string
)
)
func init ( ) {
func init ( ) {
@ -157,7 +160,7 @@ func runPurge(s *discordgo.Session) {
func ready ( s * discordgo . Session , event * discordgo . Ready ) {
func ready ( s * discordgo . Session , event * discordgo . Ready ) {
// Set the playing status.
// Set the playing status.
s . UpdateGameStatus ( 0 , "DreamDaddy v2.5 NOHEIC" )
s . UpdateGameStatus ( 0 , fmt . Spritnf ( "DreamDaddy v%+v %+v" , version , gitCommit ) )
}
}
func guildMemberUpdate ( s * discordgo . Session , m * discordgo . GuildMemberUpdate ) {
func guildMemberUpdate ( s * discordgo . Session , m * discordgo . GuildMemberUpdate ) {
@ -391,6 +394,9 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
if strings . HasPrefix ( m . Content , rebootToken ) {
if strings . HasPrefix ( m . Content , rebootToken ) {
exit ( s )
exit ( s )
}
}
if strings . HasPrefix ( m . Content , "!veri" ) {
findVerification ( s , m )
}
if strings . HasPrefix ( m . Content , "!quote" ) {
if strings . HasPrefix ( m . Content , "!quote" ) {
quotes = append ( quotes , strings . ReplaceAll ( m . Content , "!quote" , "" ) )
quotes = append ( quotes , strings . ReplaceAll ( m . Content , "!quote" , "" ) )
}
}
@ -404,3 +410,29 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
}
}
}
}
}
}
func findVerification ( s * discordgo . Session , m * discordgo . MessageCreate ) {
parts := strings . Split ( m . Content , " " )
discordId := parts [ 1 ]
matches , err := filepath . Glob ( fmt . Sprintf ( "*%+v*" , discordId ) )
if err != nil {
log . LogErrorType ( err )
return
}
if len ( matches ) != 1 {
s . ChannelMessageSend ( m . ChannelID , fmt . Sprintf ( "Error finding verification for ID %+v" , discordId ) )
return
}
verificationImage , err := os . Open ( matches [ 0 ] )
if err != nil {
log . LogErrorType ( err )
return
}
user , err := s . GuildMember ( config . GuildID , discordId )
if err != nil {
log . LogErrorType ( err )
}
msg := fmt . Sprintf ( "```%+v\nJoined: %+v\n" , user . User . Username , user . JoinedAt )
s . ChannelFileSendWithMessage ( m . ChannelID , msg , fmt . Sprintf ( "%+v Verification" , discordId ) , verificationImage )
}