admin

package
v0.0.0-...-c30703a Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BanPlayerDoc = support.CommandDoc{
	Name:  "ban",
	Usage: "$ban <player> <reason>",
	Doc:   `command bans the player on the server with a specified reason`,
}
View Source
var ConfigCommandDoc = support.CommandDoc{
	Name:  "config",
	Usage: "$config save | load | get <path> | set <path> <value>?",
	Doc:   "command manages FactoCord's config",
	Subcommands: []support.CommandDoc{
		{
			Name: "save",
			Doc: "command saves FactoCord's config from memory to `config.json`.\n" +
				"It also adds any options missing from config.json",
		},
		{
			Name: "load",
			Doc: "command loads the config from `config.json`.\n" +
				"Any unsaved changes after the last `$config save` command will be lost.",
		},
		{
			Name:  "get",
			Usage: "$config get <path>?",
			Doc: "command outputs the value of a config setting specified by <path>.\n" +
				"All path members are separated by a dot '.'\n" +
				"If the path is empty, it outputs the whole config.\n" +
				"Secrets like discord_token are kept secret.\n" +
				"Examples:\n" +
				"```\n" +
				"$config get\n" +
				"$config get admin_ids\n" +
				"$config get admin_ids.0\n" +
				"$config get command_roles\n" +
				"$config get command_roles.mod\n" +
				"$config get messages\n" +
				"```",
		},
		{
			Name: "set",
			Usage: "$config set <path>\n" +
				"$config set <path> <value>",
			Doc: "command sets the value of a config setting specified by <path>.\n" +
				"This command can set only simple types such as strings, numbers, and booleans.\n" +
				"If no value is specified, this command deletes the value if possible, otherwise it sets it to a zero-value (0, \"\", false).\n" +
				"To add a value to an array or an object specify it's index as '*' (e.g. `$config set admin_ids.* 1234`).\n" +
				"Changes made by this command are not automatically saved. Use `$config save` to do it.\n" +
				"Examples:" +
				"```\n" +
				"$config set prefix !\n" +
				"$config set game_name \"Factorio 1.0\"\n" +
				"$config set ingame_discord_user_colors true\n" +
				"$config set admin_ids.0 123456789\n" +
				"$config set admin_ids.* 987654321\n" +
				"$config set command_roles.mod 55555555\n" +
				"$config set messages.server_save **:mango: Game saved!**\n" +
				"```",
		},
	},
}
View Source
var KickPlayerDoc = support.CommandDoc{
	Name:  "kick",
	Usage: "$kick <player> <reason>",
	Doc:   `command kicks the player out from the server with a specified reason`,
}
View Source
var ModCommandDoc = support.CommandDoc{
	Name:  "mod",
	Usage: "$mod (add|remove|enable|disable) <modnames>+ | update <modnames>*",
	Doc: "command downloads, removes, enables and disables several mods.\n" +
		"If mod's name contains a whitespace ' ', it's name should be quoted using double quotes (e.g. `\"Squeak Through\"`).\n" +
		"All subcommands can process several mods at once. Mods' names should be separated by a whitespace.",
	Subcommands: []support.CommandDoc{
		{
			Name:  "add",
			Usage: "$mod add <modname>+",
			Doc: "command adds mods to mod-list.json and downloads the latest version or a specified version.\n" +
				"To download the latest version of a mod type a mod name.\n" +
				"To specify a version for a mod add '==' and a version (e.g. `$mod add FNEI==0.3.4`).\n" +
				"This command ensures that factorio version is the same as mod's factorio version.",
		},
		{
			Name: "update",
			Usage: "$mod update\n" +
				"$mod update <modname>+",
			Doc: "command updates either the specified mods or all mods.\n" +
				"To update a mod to the latest version specify mod name.\n" +
				"To update a mod to a specific version type mod name, '==', and mod version (e.g. `$mod update FNEI==0.3.4`).\n" +
				"To update all mods to the latest version use `$mod update`.\n" +
				"This command ensures that factorio version is the same as mod's factorio version.",
		},
		{
			Name:  "remove",
			Usage: "$mod remove <modname>+",
			Doc:   "command removes mods from mod-list.json and deletes mods' files",
		},
		{
			Name:  "enable",
			Usage: "$mod enable <modname>+",
			Doc:   "command enables mods in mod-list.json",
		},
		{
			Name:  "disable",
			Usage: "$mod disable <modname>+",
			Doc:   "command disables mods in mod-list.json",
		},
	},
}
View Source
var SaveServerDoc = support.CommandDoc{
	Name: "save",
	Doc:  `command sends a command to save the game to the server`,
}
View Source
var ServerCommandDoc = support.CommandDoc{
	Name: "server",
	Usage: "$server\n" +
		"$server [stop|start|restart|update <version>?]",
	Doc: "command manages factorio server.\n" +
		"`$server` shows current server status. Anyone can execute it.`",
	Subcommands: []support.CommandDoc{
		{Name: "stop", Doc: `command stops the server`},
		{Name: "start", Doc: `command starts the server`},
		{Name: "restart", Doc: `command restarts the server`},
		{
			Name: "update",
			Doc:  `command updates to server to the newest version or to the specified version`,
			Usage: "$server update\n" +
				"$server update <version>",
		},
	},
}
View Source
var UnbanPlayerDoc = support.CommandDoc{
	Name:  "unban",
	Usage: "$unban <player>",
	Doc:   `command removes the player from the banlist on the server`,
}

Functions

func BanPlayer

func BanPlayer(s *discordgo.Session, args string)

BanPlayer bans a player on the server.

func ConfigCommand

func ConfigCommand(s *discordgo.Session, args string)

ModCommand returns the list of mods running on the server.

func KickPlayer

func KickPlayer(s *discordgo.Session, args string)

KickPlayer kicks a player from the server.

func ModCommand

func ModCommand(s *discordgo.Session, args string)

ModCommand returns the list of mods running on the server.

func SaveServer

func SaveServer(s *discordgo.Session, args string)

SaveServer executes the save command on the server.

func ServerCommand

func ServerCommand(s *discordgo.Session, args string)

func ServerCommandAdminPermission

func ServerCommandAdminPermission(args string) bool

func UnbanPlayer

func UnbanPlayer(s *discordgo.Session, args string)

UnbanPlayer unbans a player on the server.

Types

type Mod

type Mod struct {
	Name    string `json:"name"`
	Enabled bool   `json:"enabled"`
	Version string `json:"version,omitempty"`
}

Mod is a struct containing info about a mod.

func (*Mod) Description

func (m *Mod) Description() *modDescriptionT

type ModJSON

type ModJSON struct {
	Mods []Mod `json:"mods"`
}

ModJSON is struct containing a slice of Mod.

Jump to

Keyboard shortcuts

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