- Notifications
You must be signed in to change notification settings - Fork4
A bot for cockatrice to be used to run tournaments with ease. Written in mostly C with the the protobuff C++ library and the Mongoose C library (copy bundled).
License
djpiper28/CockatriceTournamentBot
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Marchesa Bot (aka tricebot) is a FOSS to make hosting tournaments on cocaktriceeasier for tournament organisers. It can create games, save replays and has anintegration withSquire Bot. It currently requiresplayers to use cockatrice beta to see the games that it makes.
Live athttps://tricebot.co.uk
- Automatic game creation
- Automatic replay downloads
- Ability to kick players
- Automatic player/deck verification
This is when the bot can automatically kick players who are not welcome and tellplayeres when they load the wrong deck. Both are entirely optional. The bot getssent the list of players and decks from the api client, (i.e:Squire Bot) and then when a player whois not meant to be in the game joins they can be kicked automatically by the bot.
The bot will host an https server (with self signed keys probably) and apps thatinterface with the bot will use that to connect and send commands which will thenget a response (see src/helppage.gen.html for details). A sample implementation isin python in a file calledtricebot.py
.
Do note empty games are deleted after 30 minutes by this bot.
The file (config.conf) should be in this format:
#Cockatrice usernameusername=username#Cockatrice passwordpassword=yourpassword#Cockatrice server address you must include the portserveraddress=ws://server.cockatrice.us:4748#Auth token for the botauthtoken=nGpzR/KspN6ry7jG8CU4bonN2aujzfJa#SSL certificatecertfile=fullchain.pem#SSL certificate keycertkeyfile=privkey.pem#IP address to bind the API server to, you must include the portbindAddr=https://127.0.0.1:8000#Client ID for the bot, set to your discord bot ID if -DDISCORD=1clientID=id#Room to joinroomName=Magic#Folder to save replays to, also effects the URL that replays are servered onreplayFolder=replays#Rate limit in max messages per secondratelimit=5#Base of the external URLexternURL=https://tricebot.co.uk
Change the data for what you want. (is whitespace sensitive)For duplicate property tags, the last line of the tag is used i.e:
username=not thisusername=this is used...
You can add comments by starting a line with a hashtag (#) i.e:
#this is a commentusername=jeff...
If the bot starts and any of the values are not set in the configuration file itwill print an error message, if the values are invalid then the program may crash,I will work on a fix to that issue at some point soon. If there any issues withconfiguring the bot then do feel free to ask but dont share you password :).
The clientID is the client ID of the discord bot attched, use -DDISCORD=0 if youare not using a discord bot and set the client ID to your IP or random noise. Ifdiscord is set to 1, then the index page of the bot will be an invite link forthat bot (perms are set to admin by default).
Generate some ssl keys and slap them in the folder with the executable and thenchange the config file to have the correct names. The api server does not supportCA certificates because it is not web-facing. Ideal configuration would have thebot running on the same machine as the program that uses it.
Install dependencies (ubuntu package names):cmake g++ gcc libmbedtls-dev libprotobuf-dev protobuf-compiler libcppunit-dev build-essentials curl libcurl4-openssl-dev
The tests usecppunit
andgcovr
.
Create build directory and use cmake:
mkdir buildcd buildcmake ..# -DCMAKE_BUILD_TYPE=Debugcmake --build.# -j
Compiling with build type TEST will create the test executable then you can runit withmake coverage
or gcov to get coverage if you want.
mkdir buildcd buildcmake .. -DCMAKE_BUILD_TYPE=TESTcmake --build.# -jctest
Create an issue or look through issues for your problem, if the program crashes orhangs, please provide debug information, see below for help with that.
Compile a debug build with
mkdir buildcd buildcmake .. -DCMAKE_BUILD_TYPE=Debugcmake --build.# -j
Please copy and paste the logs from before the crash/hangand put them in yourissue, then (optional) run with a debugger and get the full backtrace of theprogram. Make sure that the program is called with an argumentof3
to get some verbose mongoose logs.
Tests are written in mostly C but use the cppunit library as needed withclasses named in camelCase. Tests are compiled by automatically and can beran withctest
or./CockatriceTournamentBotTests
.
- allow multi-room gaming
About
A bot for cockatrice to be used to run tournaments with ease. Written in mostly C with the the protobuff C++ library and the Mongoose C library (copy bundled).
Topics
Resources
License
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.