add comments

This commit is contained in:
lyx0 2021-10-31 14:57:21 +01:00
parent b77146fad5
commit 51c09c2bf8
38 changed files with 51 additions and 5 deletions

View file

@ -8,6 +8,7 @@ import (
log "github.com/sirupsen/logrus"
)
// Botstatus responds with if a given bot is verified/known and its ratelimits.
func BotStatus(channel, name string, nb *bot.Bot) {
resp, err := aiden.ApiCall(fmt.Sprintf("api/v1/twitch/botStatus/%s?includeLimits=1", name))

View file

@ -6,6 +6,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Bttv responds with a search for a given bttv emote.
func Bttv(target, emote string, nb *bot.Bot) {
reply := fmt.Sprintf("https://betterttv.com/emotes/shared/search?query=%s", emote)

View file

@ -5,6 +5,7 @@ import (
"github.com/lyx0/nourybot/pkg/utils"
)
// Coinflip responds with Heads or Tails.
func Coinflip(channel string, nb *bot.Bot) {
result := utils.GenerateRandomNumber(2)

View file

@ -7,6 +7,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Color responds with a users Twitch username color.
func Color(message twitch.PrivateMessage, nb *bot.Bot) {
reply := fmt.Sprintf("@%v, your color is %v", message.User.DisplayName, message.User.Color)

View file

@ -2,6 +2,7 @@ package commands
import "github.com/lyx0/nourybot/cmd/bot"
// Commandslist responds with a link to the list of commands.
func CommandsList(target string, nb *bot.Bot) {
reply := "https://gist.github.com/lyx0/6e326451ed9602157fcf6b5e40fb1dfd"

View file

@ -6,6 +6,8 @@ import (
"github.com/sirupsen/logrus"
)
// Currency responds with the conversion rate for two given currencies.
// Example: ()currency 10 usd to eur
func Currency(target, currAmount, currFrom, currTo string, nb *bot.Bot) {
reply, err := api.Currency(currAmount, currFrom, currTo)
if err != nil {

View file

@ -2,12 +2,8 @@ package commands
import "github.com/lyx0/nourybot/cmd/bot"
// Echo responds with the given message.
func Echo(channel, message string, nb *bot.Bot) {
// if message[0] == '.' || message[0] == '/' || message[0] == '!' {
// nb.Send(channel, ":tf:")
// return
// }
nb.Send(channel, message)
}

View file

@ -6,6 +6,7 @@ import (
log "github.com/sirupsen/logrus"
)
// Eightball asks the magic 8ball for guidance.
func EightBall(channel string, nb *bot.Bot) {
resp, err := aiden.ApiCall("api/v1/misc/8ball")

View file

@ -7,6 +7,8 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// EmoteLookup looks up a given emote and responds with the channel it is
// associated with and its tier.
func EmoteLookup(channel, emote string, nb *bot.Bot) {
reply, err := ivr.EmoteLookup(emote)

View file

@ -6,6 +6,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Ffz responds with a search link for a given ffz emote.
func Ffz(target, emote string, nb *bot.Bot) {
reply := fmt.Sprintf("https://www.frankerfacez.com/emoticons/?q=%s", emote)

View file

@ -7,6 +7,8 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Fill repeats a given emote until the whole twitch message
// is filled up with the emote and then sends it.
func Fill(channel, emote string, nb *bot.Bot) {
if emote[0] == '.' || emote[0] == '/' {
nb.Send(channel, ":tf:")

View file

@ -7,6 +7,7 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// Firstline responds a given users first message in a given channel.
func Firstline(channel, streamer, username string, nb *bot.Bot) {
ivrResponse, err := ivr.FirstLine(streamer, username)

View file

@ -7,6 +7,7 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// Followage responds with a given users time since he followed a streamer.
func Followage(channel, streamer, username string, nb *bot.Bot) {
ivrResponse, err := ivr.Followage(streamer, username)

View file

@ -8,6 +8,7 @@ import (
log "github.com/sirupsen/logrus"
)
// Game responds with the current game category a given stream is set to.
func Game(channel, name string, nb *bot.Bot) {
game, err := aiden.ApiCall(fmt.Sprintf("api/v1/twitch/channel/%s/game", name))

View file

@ -6,6 +6,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Godocs responds with a search for a given term on godocs.io
func Godocs(channel, searchTerm string, nb *bot.Bot) {
resp := fmt.Sprintf("https://godocs.io/?q=%s", searchTerm)

View file

@ -2,6 +2,7 @@ package commands
import "github.com/lyx0/nourybot/cmd/bot"
// Help responds with basic information about the bot.
func Help(target string, nb *bot.Bot) {
reply := "Bot made in Go by @Nouryqt, Prefix: (), Commands: https://gist.github.com/lyx0/6e326451ed9602157fcf6b5e40fb1dfd"

View file

@ -5,12 +5,14 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// RandomNumber calls the numbers api with a random number.
func RandomNumber(channel string, nb *bot.Bot) {
reply := api.RandomNumber()
nb.Send(channel, string(reply))
}
// Number calls the numbers api with a given number.
func Number(channel, number string, nb *bot.Bot) {
reply := api.Number(number)

View file

@ -7,6 +7,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Osrs responds with a link to a given osrs wiki search.
func Osrs(target, term string, nb *bot.Bot) {
reply := fmt.Sprint("https://oldschool.runescape.wiki/?search=" + url.QueryEscape(term))

View file

@ -8,6 +8,7 @@ import (
"github.com/lyx0/nourybot/pkg/utils"
)
// Ping responds with Pong and basic information about the bot.
func Ping(target string, nb *bot.Bot) {
commandCount := fmt.Sprint(utils.GetCommandsUsed())
botUptime := humanize.Time(nb.Uptime)

View file

@ -6,6 +6,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Pingme pings a user.
func Pingme(channel, user string, nb *bot.Bot) {
response := fmt.Sprintf("@%s", user)

View file

@ -7,6 +7,7 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// ProfilePicture responds with a link to a given users Twitch Profilepicture.
func ProfilePicture(channel, target string, nb *bot.Bot) {
reply, err := ivr.ProfilePicture(target)

View file

@ -5,6 +5,8 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// RandomCat calls the RandomCat api and responds with a link for a
// random cat image.
func RandomCat(channel string, nb *bot.Bot) {
reply := api.RandomCat()

View file

@ -5,6 +5,8 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// RandomDog calls the RandomDog api and responds with a link for a
// random dog image.
func RandomDog(channel string, nb *bot.Bot) {
reply := api.RandomDog()

View file

@ -5,6 +5,8 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// RandomDuck calls the RandomDuck api and responds with a link for a
// random duck image.
func RandomDuck(channel string, nb *bot.Bot) {
reply := api.RandomDuck()

View file

@ -5,6 +5,8 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// RandomFox calls the RandomFox api and responds with a link for a
// random fox image.
func RandomFox(channel string, nb *bot.Bot) {
reply := api.RandomFox()

View file

@ -7,6 +7,8 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// RandomQuote calls the RandomQuote api and responds with a link for a
// random quote image.
func RandomQuote(channel, target, username string, nb *bot.Bot) {
ivrResponse, err := ivr.RandomQuote(target, username)

View file

@ -5,6 +5,8 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// RandomXkcd calls the RandomXkcd api and responds with a link to a
// random xkcd comic.
func RandomXkcd(channel string, nb *bot.Bot) {
reply := api.RandomXkcd()

View file

@ -7,6 +7,8 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// Robohash takes the message ID from the message and responds
// with the robohash image link for the message id.
func RoboHash(target string, message twitch.PrivateMessage, nb *bot.Bot) {
reply := fmt.Sprintf("https://robohash.org/%s", message.ID)

View file

@ -6,6 +6,7 @@ import (
"github.com/lyx0/nourybot/cmd/bot"
)
// SevenTV responds with a link to the 7tv search for a given emote.
func SevenTV(target, emote string, nb *bot.Bot) {
reply := fmt.Sprintf("https://7tv.app/emotes?query=%s", emote)

View file

@ -7,6 +7,8 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// Subage responds with the time a given user has been subscribed
// to a given channel.
func Subage(channel, username, streamer string, nb *bot.Bot) {
ivrResponse, err := ivr.Subage(username, streamer)

View file

@ -7,6 +7,7 @@ import (
"github.com/lyx0/nourybot/pkg/utils"
)
// Thumbnail responds with the current preview image for a given channel.
func Thumbnail(channel, target string, nb *bot.Bot) {
imageHeight := utils.GenerateRandomNumberRange(1040, 1080)
imageWidth := utils.GenerateRandomNumberRange(1890, 1920)

View file

@ -8,6 +8,7 @@ import (
log "github.com/sirupsen/logrus"
)
// Title responds with the stream title for a given channel.
func Title(channel, target string, nb *bot.Bot) {
title, err := aiden.ApiCall(fmt.Sprintf("api/v1/twitch/channel/%s/title", target))

View file

@ -8,6 +8,7 @@ import (
log "github.com/sirupsen/logrus"
)
// Uptime responds with the time a given channel has been live.
func Uptime(channel, name string, nb *bot.Bot) {
resp, err := aiden.ApiCall(fmt.Sprintf("api/v1/twitch/channel/%s/uptime", name))

View file

@ -5,6 +5,7 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// Userid responds with the userid for a given user.
func Userid(channel, target string, nb *bot.Bot) {
reply := ivr.Userid(target)

View file

@ -8,6 +8,8 @@ import (
log "github.com/sirupsen/logrus"
)
// Weather calls the weather api for a given location and responds
// with the current weather data.
func Weather(channel, location string, nb *bot.Bot) {
reply, err := aiden.ApiCall(fmt.Sprintf("api/v1/misc/weather/%s", location))

View file

@ -5,6 +5,7 @@ import (
"github.com/lyx0/nourybot/pkg/api/ivr"
)
// Whois responds with information about a given users Twitch account.
func Whois(target, user string, nb *bot.Bot) {
reply := ivr.Whois(user)

View file

@ -2,6 +2,7 @@ package commands
import "github.com/lyx0/nourybot/cmd/bot"
// Xd responds with a xd
func Xd(channel string, nb *bot.Bot) {
nb.Send(channel, "xd")
}

View file

@ -5,6 +5,7 @@ import (
"github.com/lyx0/nourybot/pkg/api"
)
// Xkcd responds with a link to the current xkcd comic and information about i.
func Xkcd(channel string, nb *bot.Bot) {
reply := api.Xkcd()