You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
126 lines
6.3 KiB
126 lines
6.3 KiB
package bot
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"reflect"
|
|
)
|
|
|
|
type msgMode uint
|
|
|
|
const (
|
|
msgModeNone = iota
|
|
msgModeNormal
|
|
msgModeRude
|
|
msgModeFlirty
|
|
)
|
|
|
|
const (
|
|
msgModeNormalString = "normal"
|
|
msgModeRudeString = "rude"
|
|
msgModeFlirtyString = "flirty"
|
|
)
|
|
|
|
type msgMap map[string]string
|
|
|
|
var (
|
|
commandFormats = map[string]string{
|
|
"auser": "<Altspace VR Username> <Discord Mention> [Discord Emoji]",
|
|
"aemoji": "<Discord Mention> <Discord Emoji>",
|
|
"msg": "<Discord Mention> ...",
|
|
"accept": "(As reply) <Discord Mention> [Discord Emoji]",
|
|
"deny": "(As reply)",
|
|
"status": "[Discord Mention...]",
|
|
}
|
|
|
|
msgStrings = map[msgMode]msgMap{
|
|
msgModeNormal: {
|
|
"online_welcome": "Hello, AltVRBot online and here to serve!",
|
|
"all_done": "All done!",
|
|
"unauthorized_user": "Sorry, you are not authorized to do this!",
|
|
"invalid_command": "Invalid command format!",
|
|
"unknown_error": "I couldn't not process your request due to an unknown error!",
|
|
"auser_unknown_friend": "I don't know about this user, are you sure they are one of my friends and the username is correct?",
|
|
"auser_known_user": "I already know about this user!",
|
|
"aemoji_unknown_user": "I don't know about this user, try to associate it first!",
|
|
"msg_unknown_sender": "I don't know you! You must be associated first!",
|
|
"msg_unknown_receipient": "I don't know about <@!%s>! They must be associated first!",
|
|
"msg_invalid_receipient": "I can't message this user because it probably is myself!",
|
|
"msg_all_done_truncated": "All done, however your message was too long and truncated!",
|
|
"new_friendship_requested": "I just heard that %s would like to become friends, should I accept?",
|
|
"accept_unknown_reference": "Unknown reference, are you sure you are replying to the right message? Perhaps the request was withdrawn!",
|
|
"no_online_users": "Seems like no one is online, how lonely!",
|
|
"no_online_requested_users": "These people aren't online right now, sorry!",
|
|
},
|
|
|
|
msgModeRude: {
|
|
"online_welcome": "Ah fuck, back to work already? Well message me, maybe I'll help you anyway!",
|
|
"all_done": "Alright alright, stop bugging me already, I got it done for you, you fuck!",
|
|
"unauthorized_user": "Fartface, who the fuck do you think you are?!? You're not allowed to do that you lowlife!",
|
|
"invalid_command": "You drunk or something?",
|
|
"unknown_error": "_BOFH_",
|
|
"auser_unknown_friend": "You dimwit, you should know I don't know who this idiot is. Do I really want them to be my friend? I don't know, but maybe they do!",
|
|
"auser_known_user": "Fuckwad, I already know about this asshole!",
|
|
"aemoji_unknown_user": "Who the fuck is that? Maybe try to tell me first you airhead!",
|
|
"msg_unknown_sender": "Never heard of you chucklefuck! You even registered?",
|
|
"msg_unknown_receipient": "I don't know about this chickenfucker named <@!%s>! They must be associated first!",
|
|
"msg_invalid_receipient": "Seems obvious, but I'm gonna explain it for you half brained: I can't message myself!",
|
|
"msg_all_done_truncated": "Ok ok I did it you shitstick, but you're a verbose fuck so I had to cut your message off a bit!",
|
|
"new_friendship_requested": "Have you heard about this dipshit named %s, they think they're cool enough, ha! Should we let that numskull in?",
|
|
"accept_unknown_reference": "Numnuts, I don't know what you're talking about! That user might have been too cool for you, or you're just fucking confused!",
|
|
"no_online_users": "Everyone else has better things to do than talk you, loser!",
|
|
"no_online_requested_users": "Looks like these fucks have better things to do than talk to you, loser!",
|
|
},
|
|
|
|
msgModeFlirty: {
|
|
"online_welcome": "Hi there beautiful people, it'll be my delight to serve you!",
|
|
"all_done": "I did it for you, sweetie!",
|
|
"unauthorized_user": "I wished I could let you do that, but sadly even your good looks aren't enough to allow me!",
|
|
"invalid_command": "Love, your beauty is blinding me and I don't understand what you mean!",
|
|
"unknown_error": "We'd all love to see that happen, but the stars weren't aligned today, something unexpected happened",
|
|
"auser_unknown_friend": "I've never heard of this hotie before, would you make sure they have befriended me and the username is correct?",
|
|
"auser_known_user": "Bae, I already know this person, we were all in that cuddle puddle together the other night!",
|
|
"aemoji_unknown_user": "Sweetiepie, I don't know them, maybe you could introduce us over a glass of wine and some candles?",
|
|
"msg_unknown_sender": "Honey, I've never met you before, invite me on a date before we get cozy!",
|
|
"msg_unknown_receipient": "I've never heard of <@!%s>, but they sure do sound sexy! Maybe you could tell me more about them?",
|
|
"msg_invalid_receipient": "I'd love to write to this lovely person, but they aren't in my rolodex yet!",
|
|
"msg_all_done_truncated": "I did it for you sweetie, however your passion was too great and I had to truncate your message!",
|
|
"new_friendship_requested": "Looks like %s would like to get cozy, should we let them in the hot tub?",
|
|
"accept_unknown_reference": "As sexy as you are, I still can't find a reference to this request. Perhaps it was withdrawn!",
|
|
"no_online_users": "I'm sory sweetheart, no one's online, but I'll always be there for you!",
|
|
"no_online_requested_users": "I'm sory sweetheart, these beautiful people arent online, but I'll always be there for you!",
|
|
},
|
|
}
|
|
)
|
|
|
|
func (b *Type) getMessageString(msgID string, params ...interface{}) string {
|
|
mode := b.msgMode
|
|
p := params
|
|
if len(p) >= 1 {
|
|
if reflect.TypeOf(p[0]) == reflect.TypeOf(User{}) {
|
|
u := p[0].(User)
|
|
if u.MsgMode != msgModeNone {
|
|
mode = u.MsgMode
|
|
}
|
|
p = p[1:]
|
|
}
|
|
}
|
|
if mode == msgModeNone {
|
|
mode = msgModeNormal
|
|
}
|
|
if _, ok := msgStrings[mode][msgID]; !ok {
|
|
mode = msgModeNormal
|
|
}
|
|
if mode != msgModeNormal && msgStrings[mode][msgID] == "" {
|
|
mode = msgModeNormal
|
|
}
|
|
if val, ok := msgStrings[mode][msgID]; ok {
|
|
if val == "_BOFH_" {
|
|
val = getBOFHExcuse()
|
|
}
|
|
return fmt.Sprintf(val, p...)
|
|
}
|
|
log.Printf("Trying to fetch unknown message with key: %s\n", msgID)
|
|
return "Unknown message???"
|
|
}
|