[sockbot] I wanted a robot, So I made one
-
So you have a bot and want to use it? why not use it to help moderate a game of Mafia?
Yamikuronue and Dreikin of sockbot's home forums have put together a plugin that helps moderate mafia games.
what is a mafia game? Well what.thedailywtf.com is starting one in the next couple of days, drop on by and take a gander!
Announcing: SockMafia 2.0!
https://www.npmjs.com/package/sockmafia
SockMafia is a plugin for SockBot intended to act as a GM helper when running a forum-based game of Mafia. Mafia is a social game intended to be played with the help of a human moderator, or "GM" (for GameMaster); there is a good deal of bookkeeping involved in running the game, however, specifically around tallying votes, so this bot plugin aims to assist by providing commands the players can use and tallying up information to present to the GM to act upon. It is not capable of running a GM-less game, due to the complexity and number of judgement calls that must be made.
Usage
Player Commands
All player commands must be run in the thread the game is being played in, as they are a matter of public record.
- join: Join a game. The game in question must be in the "Preparing" stage, not yet running or completed.
- list-players: List the current living players in the game.
- list-all-players: List all players in the current game, whether alive, dead, or moderator.
- list-votes: List the current day's votes.
- vote: Vote for a player to be executed. Takes one parameter: the name of the player to be executed.
- for: Alternate form of vote. The two forms are identical unless the player in question is a doublevoter.
- nolynch: Vote for the group to not lynch anyone this current day. If No-lynch wins a vote, no execution occurs and the day ends.
- no-lynch: Identical to nolynch.
- unvote: Rescind your current vote.
Moderator commands
- prepare: Start a new game in the current thread. The person who executes this command becomes the moderator for the new game. Takes one argument: a descriptor for the game.
- start: Move the game from a preparation state to the running state, closing signups and allowing voting. Must be run in the game thread.
- set: Set a voting property for a player. Takes two arguments: the target to set, and the property to assign. Must be run in the game thread. Takes two arguments: the target username, such as '@yamikuronue', and the propery, one of loved, hated, or doublevoter.
- next-phase: Move to the next game phase. Transitions night to day, and day to night. Must be used in the game thread. Takes no arguments.
- new-day: Alias for next-phase
- kill: Kill a player. Does not transition the day. Takes one argument: the target username.
- end: Finish the game. This prevents further voting in the thread of a game that has concluded. Must be run in the game thread.
FAQ
What happened to 1.0?
It's on Github, but we never released it to NPM
How do I install this?
Now that we're on NPM, the easiest way to get a bot running is with the following simple steps:
npm install -g sockbot
npm install -g sockmafia
- Create a
config.yml
file using the below template:
--- core: username: mafiabot password: mafiapassword owner: ownerAccount forum: http://nodebb.example.com/ plugins: sockmafia: thread: 52778 mods: - mod players: - player1 - player2 db: './mafiadb' name: testMafia voteBars: bastard
- run
sockbot config.yml
Tadah!
What features are included in this release?
- Voting and vote tracking
- Loved, Hated, and Doublevoter properties
- Vote bar configuration options (Bastard bars for weng-style;
open
for visible vote totals;hidden
for no leaking.)
Where can I report issues with the plugin?
We use Github for issue tracking.
-
@UncleSam the example config i posted in the opening post should get you a bot that runs the summoner plugin using Zoidberg quotes.
Do you get any output on the console when you run your configuration? can you please post the output you have, either here or in a private chat with me?
-
i get this output, but nothing more hapens.
[2016-06-01T13:18:16.637Z] Starting Sockbot 3.1.0 - Beta Badger
[2016-06-01T13:18:16.653Z] Loaded configuration file: example.config.yml
[2016-06-01T13:18:16.654Z] Activating logon: DumDum
[2016-06-01T13:18:16.859Z] Using provider nodebb for DumDum
[2016-06-01T13:18:16.863Z] Loading plugin summoner for DumDum
[2016-06-01T13:18:16.865Z] DumDum ready for login
[2016-06-01T13:18:18.155Z] DumDum login successful
[2016-06-01T13:18:43.193Z] Ping exchanged with 1ms latency
[2016-06-01T13:19:08.200Z] Ping exchanged with 0ms latency
[2016-06-01T13:19:33.208Z] Ping exchanged with 1ms latency
[2016-06-01T13:19:58.230Z] Ping exchanged with 1ms latency
[2016-06-01T13:20:23.235Z] Ping exchanged with 1ms latency -
@UncleSam that looks like a good login output to me.
what happens when you @mention the bot account on the forum to trigger the summon?
if that still fails try sending the following to the bot in a chat:
!help
does the bot reply to that chat with anything?
if not please try starting the bot in debug mode and capturing the output from that by executing:
$> DEBUG=sockbot* sockbot path/to/config.yml
-
Nah nothing happens when i try @mention and !help
in debug mode i get this
[2016-06-01T18:20:16.337Z] Starting Sockbot 3.1.0 - Beta Badger
[2016-06-01T18:20:16.354Z] Loaded configuration file: example.config.yml
[2016-06-01T18:20:16.354Z] Activating logon: DumDum
sockbot requiring providers nodebb as /usr/lib/node_modules/sockbot/lib/../providers/nodebb +0ms
[2016-06-01T18:20:16.559Z] Using provider nodebb for DumDum
[2016-06-01T18:20:16.563Z] Loading plugin summoner for DumDum
sockbot requiring plugins summoner as /usr/lib/node_modules/sockbot/lib/../plugins/summoner +208ms
[2016-06-01T18:20:16.567Z] DumDum ready for login
sockbot:provider:nodebb begin configuration fetch for CSRF token +4ms
sockbot:provider:nodebb completed configuration fetch for CSRF token +47ms
sockbot:provider:nodebb begin post login data +0ms
sockbot:provider:nodebb complete post login data +1s
[2016-06-01T18:20:17.885Z] DumDum login successful
sockbot:provider:nodebb:user retrieving user by login DumDum +94ms
sockbot:provider:nodebb:user retrieving user by login accalia +6ms
[2016-06-01T18:20:42.963Z] Ping exchanged with 2ms latency
[2016-06-01T18:21:07.970Z] Ping exchanged with 1ms latency
[2016-06-01T18:21:32.993Z] Ping exchanged with 1ms latency
[2016-06-01T18:21:57.999Z] Ping exchanged with 0ms latency
[2016-06-01T18:22:23.016Z] Ping exchanged with 0ms latency
[2016-06-01T18:22:48.026Z] Ping exchanged with 1ms latency -
@UncleSam that's........ strange.....
if you manually log into the bot account and view its profile page can you see any existing login sessions under the settings page.
they should show up as
unknown on Linux
orunknown on Windows
depending on what OS the bot is running on (looks like Linux from your logs) -
@UncleSam huh. and did the bot actually receive notifications from the forum in the time period it was online?
if so.... i'm very confused.... but never fear i will figure this out. there's one more piece of debugging available to me!
could you enable Ultra Debug Mode<sup>TM</sup> and send me a link via chat to a pastebin or gist of the file it generates?
There is a possibility of sensitive information being revealed through Ultra Debug Mode<sup>TM</sup> so please make sure the pastebin or gist is private and send the link to me over chat, rather than posting on the forum.
to enable Ultra Debug Mode<sup>TM</sup> run the bot with the following command:
$> DEBUG=* sockbot /path/to/config.yml 2>&1 | tee logfile.txt
then run the bot through it's paces by mentioning it and sending the help command via chat to the bot before sending me
logfile.txt
That should provide me with all the necessary information to determine what's gone wrong.
Thank you for your patience and understanding in this matter.
-
Release v3.1.1 has been released to github and npm
Fixes several bugs in 3.1.10 including (but not limited to)
- Mentions were not being processed correctly, breaking the summoner plugin
Notable updates in this merge:
- update travis and tests for release of nodejs 6.0
- resolve SockDrawer/SockBot#305
- add formatters to format URLs for a forum.
- add quoteText format function. resolves SockDrawer/SockBot#309, enables SockDrawer/sockMafia#66
- add misc format functions resolves SockDrawer/SockBot#311
- change post link format, resolves SockDrawer/SockBot#308
- release version 3.1.1 fixing mention notifications
-
@UncleSam please install the new version and test. it should resolve your issue with the summoner plugin.
-
@accalia tried to run and getting this
sockbot example.config.yml
const path = require('path');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3 -
@exodo said in [sockbot] I wanted a robot, So I made one:
SyntaxError: Use of const in strict mode.
hmm...
let me guess..... node version 0.12?
sockbot unfortunately uses a lot of features of ES6 and thus requires version 4.0 to run.
it may be possible to run in version 0.12 using the
--harmony
command line flag but that configuration is, unfortunately not supported. -
@accalia said in [sockbot] I wanted a robot, So I made one:
@exodo said in [sockbot] I wanted a robot, So I made one:
SyntaxError: Use of const in strict mode.
hmm...
let me guess..... node version 0.12?
sockbot unfortunately uses a lot of features of ES6 and thus requires version 4.0 to run.
it may be possible to run in version 0.12 using the
--harmony
command line flag but that configuration is, unfortunately not supported.i see, my test server doesnt support that new realeases, thank anyways
-
@exodo said in [sockbot] I wanted a robot, So I made one:
i see, my test server doesnt support that new realeases, thank anyways
unless there's a specific reason why the newer versions of nodejs are not supported i have found nvm to work just fine for managing multiple versions of nodsjs.
in fact all development for sockbot is done using nvm installed version of node so as to allow me to quickly switch between versions to test functionality against multiple versions of nodejs.
I'd be happy to help you set up a user account on your test server with nvm so that you can use sockbot on that server without interfering with the already installed applications..... if that's a thing you'd like to do?
I have also confirmed that cloud9 ide fully supports sockbot in its free tier (and comes with nvm preconfigured). Workspaces for the free tier are quickly frozen when idle, so good for testing, not so good for long term use.
-
@accalia said in [sockbot] I wanted a robot, So I made one:
@exodo said in [sockbot] I wanted a robot, So I made one:
i see, my test server doesnt support that new realeases, thank anyways
unless there's a specific reason why the newer versions of nodejs are not supported i have found nvm to work just fine for managing multiple versions of nodsjs.
in fact all development for sockbot is done using nvm installed version of node so as to allow me to quickly switch between versions to test functionality against multiple versions of nodejs.
I'd be happy to help you set up a user account on your test server with nvm so that you can use sockbot on that server without interfering with the already installed applications..... if that's a thing you'd like to do?
I have also confirmed that cloud9 ide fully supports sockbot in its free tier (and comes with nvm preconfigured). Workspaces for the free tier are quickly frozen when idle, so good for testing, not so good for long term use.
thanks for the support, i wil check all that
i work on synology so actually i think its not posible to update it -
@exodo said in [sockbot] I wanted a robot, So I made one:
i work on synology so actually i think its not posible to update it
hmm... interesting. don't think i've worked with them before. I've got a QNAP NAS myself and use an Intel NUC, or a Raspberry Pi, as my test box....
still NVM should work for you, it installs to your home directory so it doesn't interfere with other users or the system.
@exodo said in [sockbot] I wanted a robot, So I made one:
thanks for the support
no worries. it's what i do. let me know if i can do anything more to help.
-
When i install bot ant try to run it i get error
"nodebb A-derp! Fatal Startup Error: Unexpected token < " HELP? -
@Domas-Vileikis interesting error...
could you post the configuration file you are using for the bot (with password redacted for security) so i can take a look at it? most errors like this are simple typos in configuration and should be easy to solve.