Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.
/ TF2MChatBots Public archive

An Application that can run various bots for TF2M, but instead just runs VBot

Notifications You must be signed in to change notification settings

TF2Maps/TF2MChatBots

Repository files navigation

VBOT

VBot is a program that is utilised by the TF2Maps community, accessible via the steam group chat and discord channel. Its primary purpose is to improve the capability of the online chatroom as well as improve the development process for members.

VBot allows users to actively add their Maps into the chat-bot’s list, and all maps in the list can be recited anytime through a command. Furthermore VBot will actively connect to TF2Map’s Game Servers and remove maps from the list when they are ran, and notify the user through a private message (as well as post in the chatroom on map-change to encourage users to join).

VBot’s module-based design allows for the easy integration and isolated development of numerous functions w/o causing disturbance to the primary features, the Bot has a MOTD module that broadcasts a message hourly to the chatroom, a Saved Replies Module (e.g: /maps replies http://vbot.site/) and an online search module for the Team Fortress 2 development reference site as well as TF2maps.net itself.

The design of the bot allows for a single “UserHandler” to handle and process requests on multiple platforms simultaneously (and has been integrated to also work with Discord) as instead ‘InterfacePlatforms’ normalize the data across platforms and serve as a bridge. VBot also hosts a website at: http://vbot.site/ that allows users to view the maps currently in the queue.

Maintaners

This program is primarily written, maintained, deployed and updated by Ben "Fantasmos" Krajancic, all questions should be sent to him.

Maxine Dupis https://github.com/maxdup was responsible for developing the initial modules and command system, however due to issues with github the initial commit was made under fantasmos' account at: https://github.com/TF2Maps/SteamBotLite/commit/fe204c423372e8038c1a77ded378a22630d8522a

General code structure

A general idea of the code is:

There are "interfaces" to external services (Steam and Discord Currently) There are "Chathandlers" which will respond to messages through events. (VBot being the major one)

Interfaces can be linked to chathandlers. Interfaces will translate the data into an abstract form for the chathandlers to do work on, similarly chathandlers will fire events in response TO the interfaces, in a similarly abstract form. A cool thing is a single chathandler can be linked to many interfaces.

Configuring:

In bin/example there are several files.

config.json is used by the VBot Userhandler, i've provided an example configuration for it. If there's a module loaded in VBot that isn't in the config it'll throw an error upon initialisation.

The files in applicationconfigs are used for "Interfaces" to login, as well as restrict their chat. They are named (and case-sensitive) to the classes that load them. For example "SteamAccountVBot" class will load SteamAccountVBot.json

Setting up

In examples/bins/ a set of configuration and example files are provided for VBot. Here is an explanation for them. Knowledge of VBot's capabilities is assumed in the following explanations.

Configuring config.json

The config.json provides configuration for VBot's various modules. This section is organised per module.

MapWebServer

HeaderfileName/TrailerFileName: VBot hosts a website. The webpage is generated by combining: header.html, a generated html, and the trailer html. These values provide the files which are the header and trailer.

FilesDirectory: The folder which contains the header and trailer file

Address: The address to run the webserver. http://*:80 is good for default.

CSSPath: The path of the CSS file

IdentityModule

THis module handles the username and status displayed of VBot. The values are self explanatory

MapModule

ServerMapListURL: This is the URL used to check if a map is already uploaded

MaxMapList: How many maps are shown when !maps is used

CountDownModule, MotdModule, ImpNaoModule

These are now unused, but are kept in as these modules could be reactivated one day if needed and are needed for example.

ServerTrackingModule

UpdateInterval: How frequently to check for server changes

Servers: Unused value, configuration is in module configuration.

ServerListHolder

Unsure what this is used for TBH.

VBot (bin/example/VBot/)

In the configuration files, there is the VBot directory which has further configuration for each module, and also saved data.

SearchModule.JSON

This file contains data used for making searches using VBot. The search module works by loading the contents of a webpage (which is generated by query string, eg "!VDC " will make a url consisting of then spidering the result using spiderprefix and spidersuffix.

Examples provided demonstrate how to include a google search of a website.

RepliesModule, ServerModule, IdentityModule

These modules can be configured through commands in VBot, therefore it is not needed to be discussed here.

Other Modules

The other modules are either there for consistency, or saved data and do not need to thought about.

Applicationsconfigs

HTTPInterface.json

Httpinterface is used to communicate with Discord through the webhook API. Setup an application at: https://discordapp.com/developers/ and learn about webooks at: https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks

Some values are unused, and have defaults set. The others are:

Webhook: When the Discord Account is loaded, it will post "Hello World" to this webhook.

Token: The discord API token. Get one at: https://discordapp.com/developers/applications/222204046260305922/information

Channels: The channel id's to track, and webhooks used to respond to the channel with. The ID is found in discord by right clicking the channel and selecting "Copy ID". Webhooks are made in the usual manner on discord.

Broadcast: The webhook used for broadcast messages.

PrivateMSGS: As VBot is supposed to send Private messages but can't do so using webhooks, what channel should be used to send private messages

Whitelist/Blacklist: Unused

Admins: ID's of roles to treat as admins. Retrieve by posting @ to discord.

SteamAccountVBot.json

This provides an example of how to login to a steam account, most fields are self explanatory.

Whitelist is an array of groupid's used to automatically join steam chat rooms.

Scripts

VBot running on linux is able to run bash scripts. This directory contains the files which can be run.

Installation Guide

Windows

Simply download the git repo, and compile the program, you will need to copy the files from bin/example into the build directory.

Linux

First install mono, instructions are at: https://www.mono-project.com/docs/getting-started/install/linux/

You will then need to install mono-devel (to compile) and git (to download the repo)

sudo apt install mono-devel

sudo apt install git

Then you need to download the project

git clone https://github.com/TF2Maps/TF2MChatBots.git

cd TF2MChatBots

git pull You need to get the compiler

sudo apt-get install msbuild

The software utilises a variety of nuget packages, so you need to install nuget, then run it to retrieve needed packages

sudo apt install nuget

nuget restore

Then you can compile the bot. There will be errors as the test suite will fail to compile, but the main project which outputs the executable needed to run the software will succeed.

msbuild /p:Configuration=Release

You then need to copy files from bin/example into bin/release, or use your own configuration files.

cp -r bin/example/* bin/Release

Once you configire the software by editing the files, it can be run with:

cd bin

cd Release

mono SteamBotLite.exe

About

An Application that can run various bots for TF2M, but instead just runs VBot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages