257 lines
3.9 KiB
Go
257 lines
3.9 KiB
Go
package twitchat
|
|
|
|
import (
|
|
"fmt"
|
|
"hash/fnv"
|
|
"math/rand"
|
|
"time"
|
|
|
|
"github.com/gempir/go-twitch-irc/v2"
|
|
)
|
|
|
|
const emoteMsg = "!emote"
|
|
|
|
var (
|
|
emotes = []string{
|
|
"4Head",
|
|
"ANELE",
|
|
"ArgieB8",
|
|
"ArsonNoSexy",
|
|
"AsexualPride",
|
|
"AsianGlow",
|
|
"BCWarrior",
|
|
"BOP",
|
|
"BabyRage",
|
|
"BatChest",
|
|
"BegWan",
|
|
"BibleThump",
|
|
"BigBrother",
|
|
"BigPhish",
|
|
"BisexualPride",
|
|
"BlargNaut",
|
|
"BlessRNG",
|
|
"BloodTrail",
|
|
"BrainSlug",
|
|
"BrokeBack",
|
|
"BuddhaBar",
|
|
"CarlSmile",
|
|
"ChefFrank",
|
|
"CoolCat",
|
|
"CoolStoryBob",
|
|
"CorgiDerp",
|
|
"CrreamAwk",
|
|
"CurseLit",
|
|
"DAESuppy",
|
|
"DBstyle",
|
|
"DansGame",
|
|
"DarkMode",
|
|
"DatSheffy",
|
|
"DendiFace",
|
|
"DogFace",
|
|
"DoritosChip",
|
|
"DrinkPurple",
|
|
"DxCat",
|
|
"EarthDay",
|
|
"EleGiggle",
|
|
"EntropyWins",
|
|
"FBBlock",
|
|
"FBCatch",
|
|
"FBChallenge",
|
|
"FBPass",
|
|
"FBPenalty",
|
|
"FBRun",
|
|
"FBSpiral",
|
|
"FBtouchdown",
|
|
"FUNgineer",
|
|
"FailFish",
|
|
"FrankerZ",
|
|
"FreakinStinkin",
|
|
"FutureMan",
|
|
"GayPride",
|
|
"GenderFluidPride",
|
|
"GingerPower",
|
|
"GivePLZ",
|
|
"GrammarKing",
|
|
"GreenTeam",
|
|
"GunRun",
|
|
"HSCheers",
|
|
"HSWP",
|
|
"HassaanChop",
|
|
"HassanChop",
|
|
"HeyGuys",
|
|
"HolidayCookie",
|
|
"HolidayLog",
|
|
"HolidayOrnament",
|
|
"HolidayPresent",
|
|
"HolidaySanta",
|
|
"HolidayTree",
|
|
"HotPokket",
|
|
"HumbleLife",
|
|
"IntersexPride",
|
|
"InuyoFace",
|
|
"ItsBoshyTime",
|
|
"JKanStyle",
|
|
"Jebaited",
|
|
"JonCarnage",
|
|
"KAPOW",
|
|
"Kappa",
|
|
"KappaClaus",
|
|
"KappaPride",
|
|
"KappaRoss",
|
|
"KappaWealth",
|
|
"Kappu",
|
|
"Keepo",
|
|
"KevinTurtle",
|
|
"Kippa",
|
|
"KomodoHype",
|
|
"KonCha",
|
|
"Kreygasm",
|
|
"LUL",
|
|
"LesbianPride",
|
|
"MVGame",
|
|
"Mau5",
|
|
"MaxLOL",
|
|
"MercyWing1",
|
|
"MercyWing2",
|
|
"MikeHogu",
|
|
"MingLee",
|
|
"MorphinTime",
|
|
"MrDestructoid",
|
|
"NinjaGrumpy",
|
|
"NomNom",
|
|
"NonBinaryPride",
|
|
"NotATK",
|
|
"NotLikeThis",
|
|
"OSFrog",
|
|
"OhMyDog",
|
|
"OneHand",
|
|
"OpieOP",
|
|
"OptimizePrime",
|
|
"PJSalt",
|
|
"PJSugar",
|
|
"PMSTwin",
|
|
"PRChase",
|
|
"PanicVis",
|
|
"PansexualPride",
|
|
"PartyHat",
|
|
"PartyTime",
|
|
"PeoplesChamp",
|
|
"PermaSmug",
|
|
"PicoMause",
|
|
"PinkMercy",
|
|
"PipeHype",
|
|
"PixelBob",
|
|
"PogChamp",
|
|
"Poooound",
|
|
"PopCorn",
|
|
"PorscheWIN",
|
|
"PowerUpL",
|
|
"PowerUpR",
|
|
"PraiseIt",
|
|
"PrimeMe",
|
|
"PunOko",
|
|
"PunchTrees",
|
|
"PurpleStar",
|
|
"RaccAttack",
|
|
"RalpherZ",
|
|
"RedCoat",
|
|
"RedTeam",
|
|
"ResidentSleeper",
|
|
"RitzMitz",
|
|
"RlyTho",
|
|
"RuleFive",
|
|
"SMOrc",
|
|
"SSSsss",
|
|
"SabaPing",
|
|
"SeemsGood",
|
|
"SeriousSloth",
|
|
"ShadyLulu",
|
|
"ShazBotstix",
|
|
"SingsMic",
|
|
"SingsNote",
|
|
"SmoocherZ",
|
|
"SoBayed",
|
|
"SoonerLater",
|
|
"Squid1",
|
|
"Squid2",
|
|
"Squid3",
|
|
"Squid4",
|
|
"StinkyCheese",
|
|
"StoneLightning",
|
|
"StrawBeary",
|
|
"SuperVinlin",
|
|
"SwiftRage",
|
|
"TBAngel",
|
|
"TF2John",
|
|
"TPFufun",
|
|
"TPcrunchyroll",
|
|
"TTours",
|
|
"TakeNRG",
|
|
"TearGlove",
|
|
"TehePelo",
|
|
"ThankEgg",
|
|
"TheIlluminati",
|
|
"TheRinger",
|
|
"TheTarFu",
|
|
"TheThing",
|
|
"ThunBeast",
|
|
"TinyFace",
|
|
"TombRaid",
|
|
"TooSpicy",
|
|
"TransgenderPride",
|
|
"TriHard",
|
|
"TwitchLit",
|
|
"TwitchRPG",
|
|
"TwitchSings",
|
|
"TwitchUnity",
|
|
"TwitchVotes",
|
|
"UWot",
|
|
"UnSane",
|
|
"UncleNox",
|
|
"VoHiYo",
|
|
"VoteNay",
|
|
"VoteYea",
|
|
"WTRuck",
|
|
"WholeWheat",
|
|
"WutFace",
|
|
"YouDontSay",
|
|
"YouWHY",
|
|
"bleedPurple",
|
|
"cmonBruh",
|
|
"copyThis",
|
|
"duDudu",
|
|
"imGlitch",
|
|
"mcaT",
|
|
"panicBasket",
|
|
"pastaThat",
|
|
"riPepperonis",
|
|
"twitchRaid",
|
|
}
|
|
)
|
|
|
|
type (
|
|
dailyEmote struct{}
|
|
)
|
|
|
|
func DailyEmote() *dailyEmote {
|
|
return new(dailyEmote)
|
|
}
|
|
|
|
func (h *dailyEmote) IsValid(m *twitch.PrivateMessage) bool {
|
|
return (m.Tags["msg-id"] == "highlighted-message") && m.Message == emoteMsg
|
|
}
|
|
|
|
func (h *dailyEmote) Handle(m *twitch.PrivateMessage, r Responser) {
|
|
data := time.Now().Format("2006-01-02") + m.User.DisplayName
|
|
rng := rand.New(rand.NewSource(hashSeed(data)))
|
|
emote := emotes[rng.Intn(len(emotes))]
|
|
|
|
msg := fmt.Sprintf("@%s твой эмоут дня: %s", m.User.DisplayName, emote)
|
|
r.Say(m.Channel, msg)
|
|
}
|
|
|
|
func hashSeed(s string) int64 {
|
|
h := fnv.New64()
|
|
h.Write([]byte(s))
|
|
return int64(h.Sum64())
|
|
}
|