setstatus

package
v1.31.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &commands.YAGCommand{
	Cooldown:             2,
	CmdCategory:          commands.CategoryDebug,
	HideFromCommandsPage: true,
	Name:                 "setstatus",
	Description:          "Sets the bot's status and streaming url",
	HideFromHelp:         true,
	Arguments: []*dcmd.ArgDef{
		{Name: "status", Type: dcmd.String, Default: ""},
	},
	ArgSwitches: []*dcmd.ArgDef{
		{Name: "url", Type: dcmd.String, Default: ""},
		{Name: "idle", Help: "Switches idle status"},
	},
	RunFunc: util.RequireBotAdmin(func(data *dcmd.Data) (interface{}, error) {
		var idle, idleState string

		err := common.RedisPool.Do(radix.Cmd(&idle, "GET", "status_idle"))
		if err != nil {
			fmt.Println((fmt.Errorf("failed retrieving bot streaming status")).Error())
		}
		idleState = idle

		streamingURL := data.Switch("url").Str()
		if data.Switches["idle"].Value != nil && data.Switches["idle"].Value.(bool) {
			if idle == "" {
				idle = "enabled"
				idleState = "enabled"
			} else {
				idle = ""
				idleState = "disabled"
			}
		}
		bot.SetStatus(streamingURL, data.Args[0].Str(), idle)
		if idleState != "" {
			return "Doneso... your idle state is " + idleState, nil
		} else {
			return "Doneso", nil
		}

	}),
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL