commands

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commands = [...]Command{

	{
		Name:    "server",
		Command: admin.ServerCommand,
		Admin:   admin.ServerCommandAdminPermission,
		Doc:     &admin.ServerCommandDoc,
		Desc:    "Manage factorio server",
	},
	{
		Name:    "save",
		Command: admin.SaveServer,
		Admin:   alwaysAdmin,
		Doc:     &admin.SaveServerDoc,
		Desc:    "Save the game",
	},
	{
		Name:    "kick",
		Command: admin.KickPlayer,
		Admin:   alwaysAdmin,
		Doc:     &admin.KickPlayerDoc,
		Desc:    "Kick a user from the server",
	},
	{
		Name:    "ban",
		Command: admin.BanPlayer,
		Admin:   alwaysAdmin,
		Doc:     &admin.BanPlayerDoc,
		Desc:    "Ban a user from the server",
	},
	{
		Name:    "unban",
		Command: admin.UnbanPlayer,
		Admin:   alwaysAdmin,
		Doc:     &admin.UnbanPlayerDoc,
		Desc:    "Unban a user from the server",
	},
	{
		Name:    "config",
		Command: admin.ConfigCommand,
		Admin:   alwaysAdmin,
		Doc:     &admin.ConfigCommandDoc,
		Desc:    "Manage config.json",
	},
	{
		Name:    "mod",
		Command: admin.ModCommand,
		Admin:   alwaysAdmin,
		Doc:     &admin.ModCommandDoc,
		Desc:    "Manage mod-list.json",
	},

	{
		Name:    "mods",
		Command: utils.ModsList,
		Admin:   nil,
		Doc:     &utils.ModListDoc,
		Desc:    "List the mods on the server",
	},
	{
		Name:    "version",
		Command: utils.VersionString,
		Admin:   nil,
		Doc:     &utils.VersionDoc,
		Desc:    "Get server version",
	},
	{
		Name:    "info",
		Command: utils.GameInfo,
		Admin:   nil,
		Doc:     &utils.InfoDoc,
		Desc:    "Get server info",
	},
	{
		Name:    "online",
		Command: utils.GameOnline,
		Admin:   nil,
		Doc:     &utils.OnlineDoc,
		Desc:    "Get players online",
	},
	{
		Name:  "help",
		Admin: nil,
		Doc: &support.CommandDoc{
			Name: "help",
			Usage: "$help\n" +
				"$help <command>\n" +
				"$help <command> <subcommand>",
			Doc: "command returns list of all commands and documentation about any command and its' subcommands",
		},
		Desc: "List the commands for Factocord and get documentation on commands and subcommands. Try `$help help`",
	},
}

Commands is a list of all available commands

Functions

func CheckAdmin

func CheckAdmin(ID string) bool

CheckAdmin checks if the user attempting to run an admin command is an admin

func RunCommand

func RunCommand(input string, s *discordgo.Session, m *discordgo.Message)

RunCommand runs a specified command.

Types

type Command

type Command struct {
	Name string

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

	Admin func(args string) bool
	Doc   *support.CommandDoc
	Desc  string
}

Command is a struct containing fields that hold command information.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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