[sockbot] I wanted a robot, So I made one


  • Plugin & Theme Dev

    Sockbot 3.0 - Alpha Alpaca - The NodeBB release

    It is with great pleasure that i announce the release of version 3.0.0 of sockbot featuring support for NodeBB forums.

    Sockbot is a userbot that logs in as a standard user and performs actions based on that users behalf. Interactions with the bot can then be achieved via posting messages to the bot.

    Sockbot 3.0 includes two plugins by default echo and summoner, The SockDevs will be releasing more plugins in the future and any interested party is welcome to write their own. We will be providing detailed how-tos regarding writing all sorts of plugins in the near future.

    You can install sockbot via npm, read the docs, view the code and contribute, and file bug reports/feature requests

    Requirements

    In order to run Sockbot you will need at least version 4.0 of nodejs. Version 5.0 or greater is recommended

    Sockbot is developed and tested on Linux, however it should work just fine on Windows and OSX as well.

    Installation

    It is recommended to install Sockbot globally via NPM if you have sufficient access. This adds the binary to your command line environment for convenient access.

    Execute the NPM command below to install Sockbot globally.

    $ npm install -g sockbot
    

    Once sockbot is installed you will need a configuration file to set up necessary settings. Here's one i've prepared earlier that utilizes the summoner module to implement a bot that quotes Zoidberg when mentioned:

    --- 
    - core:
        username: "Zoidberg"
        password: "ZoidbergsPasswordZoidbergsPassword"
        owner: "accalia"
        forum: "http://nodebb.example.com"
      plugins: 
        summoner: 
          messages: 
            - "@%username%, You seem malnourished. Are you suffering from internal parasites?"
            - "@%username%. I challenge you to \"clawplach\"!"
            - "I wonder what the Shroud of Turin tastes like."
            - "Yeah, but did you ever play Jenga? Sometimes you take out one and... [imitates crashing]"
            - "It's good cholesterol, but it spreads like bad cholesterol."
            - "Zoidberg is afoot!"
            - "On margin. Zoidbee wants to buy on margin."
            - "Zoidbie want balloon! Want balloon now! Zoidbie want go outside!"
            - "Tired of Discourse? Why not @Zoidberg?"
            - "I took the liberty of fertilizing your caviar."
            - "I've had it with this game. I'm going for a scuttle."
            - "Doctor Zoidberg, soaking in brine."
            - "You lost the @%username% of your dreams, but you still have Zoidberg. YOU ALL STILL HAVE ZOIDBERG!"
            - "Sit down @%username%. Now open your mouth and lets have a look at that brain. "
            - "Young lady, I am an expert on humans. Now pick a mouth, open it and say \"brglgrglgrrr\"! "
            - "Hooray! People are paying attention to me!"
            - "I've performed a few mercy killings."
            - "It's been years since medical school, so remind me. Disemboweling in your species, fatal or non-fatal?"
            - "The frenzy is over. How am I going to get rid of my male jelly now?"
            - "Welcome to my life! :starts crying:"
            - "I don't like the looks of this doctor. I bet I've lost more patients than he's treated."
            - "What? My mother was a saint! Get out!"
            - "It's funny because it's poisonous!"
            - "Fine, then I'll have one of your young on a roll."
            - "Fine, just give me something crawling with parasites."
            - "And I'm his friend, Jesus!"
            - "Hooray! I'm a teenage heartthrob again!"
            - "There's a humongous fungus among us."
            - "I ate garbage yesterday, and it didn't cost me 300 dollars."
            - "Hey, boys and girls. It's Zoidberg, the loveable tramp."
            - "Hooray! A happy ending for the rich people."
            - "Switch bodies? I don't see why not. I also don't see why."
            - "The hell with your spoiled baby. I need those shoes."
            - "@%username%, look what you did! She won't shut up."
            - "Friends! Help! A guinea pig tricked me!!"
            - "Is it me maybe?"
            - "Once again, the conservative, sandwich-heavy portfolio pays off for the hungry investor."
            - "Ohhh, it's all so complicated, with the flowers, and the romance, and the lies upon lies."
            - "What's this? Two meals in one week?"
            - "Friends! Help! A @%username% tricked me!"
            - "Oh, no! Something's happening! What's happening?"
            - "Are you coming on to me?"
            - "At last, recognition!"
            - "Hello? I'll take eight!"
            - "Hooray! I'm helping!"
    

    Configuration files may be in JSON or YAML format.

    Once you have a configuration file you can start Sockbot by executing the sockbot command with the path to the configuration file as a parameter as seen below.

    $ sockbot path/to/config.yml
    

    This will start the bot, once the bot has logged in you can go to your forum and mention the bot account to get a random Zoidberg quote!

    Up to date installation instructions can be found in the docs, including alternate installation setups.

    Other uses

    Commands

    Sockbot also understands a command format such that can be issued to the bot. All issued commands are registered so that they will be reported by the help command. Sockbot processes commands from any post that generates a notification to the bot and understands two different formats.

    The echo plugin contains an example of using commands in a plugin. The echo plugin adds an echo command to the bot that when triggered replies to the post with a quote of the original post text.

    Mention commands

    Mention commands prefix a mention of the bot to the command name. The mention must be the first non markup element on a line, and must not be in a code block or quote.

    The format for a mention command makes it convenient to issue a command to the bot in such a way that it is guaranteed to generate a notification.

    For example. To execute the florblewitz command with arguments with and arguments you would post:

    @sockbot florblewitz with arguments
    

    Imperative Commands

    Imperative commands prefix an exclamation mark to the command name. The command must be the first non markup element on a line, and must not be in a code block or quote.

    The format for an imperative command makes it convenient for issuing multiple commands per post where the bot will already receive a notification for the post

    For example. To execute the florblewitz command with arguments with and arguments you would post:

    !florblewitz with arguments
    

    Help

    We, the SockDevs, are here to help! Ask questions in this thread, read our documentation, and/or file bug reports and feature requests in our issue tracker


  • Global Moderator

    Awesome!


  • Admin

    Wow, this is fantastic šŸ˜„

    Glad to get such a full featured bot for NodeBB! @Schamper sounds like Botler's out of a job šŸ˜†


  • Plugin & Theme Dev

    @julian said in [sockbot] I wanted a robot, So I made one

    Glad to get such a full featured bot for NodeBB

    full featured?

    not hardly!

    We still haven't added support for chats and with summoner to provide "witty" commentary as the only official plugin so far (echo is really just a testing plugin) we're still pretty bare for actual utilized functionality.

    that being said....

    what kind of functionality would you like to see added?


  • Plugin & Theme Dev

    @julian good, now I finally won't feel pressured to actually finish it :)


  • Plugin & Theme Dev

    @Schamper but-but-but competition is good for a free market!

    what if the people are not free to choose which bot they wish to use for their botting porpoises? what will happen to the market then?

    Lacking competitive market forces will it not stagnate and rot, to the detriment of all?

    </minitroll>


  • Plugin & Theme Dev

    Released version 3.1.0-RC1 on github and npm

    this is a PRE-RELEASE version and as such may have new and undiscovered bugs.

    v3.1.0-RC1

    Fixes several bugs in v3.0.0 including (but not limited to)

    • Failed logins were reported as successful
    • Split notification:mention event into notification:mention and notification:group_mention events
    • Failure for a plugin to load was not reported, leading to confusion

    Noteable updates in this merge:

    • Misc test fixes from test audit
    • update readme for version 3.0
    • remove ignored codeclimate folder
    • update travis configuration
    • release 3.0.0
    • fix crash bug on run and add test to catch regressions of crash bug of 0b95898
    • implement group_mention notification type
    • adjust configuration validation to include checking for plugin configurations - fixes #293
    • detect when plugin fails to load and fail the bot start because of it
    • detect failed nodebb login - resolves #294
    • release 3.1.0-RC1

  • Plugin & Theme Dev

    @accalia took a certain fox long enough but....

    Release v3.1.0 has been released to github and npm

    New features:

    • Support for nodebb chats, including support for commands in chats
    • Split notification:mention event into notification:mention and notification:group_mention events

    Fixes several bugs in 3.0.0 including (but not limited to)

    • Failed logins are reported as successful
    • Failure for a plugin to load was not reported, leading to confusion

    Notable updates in this merge:

    • Misc test fixes from test audit
    • update readme for version 3.0
    • adjust configuration validation to include checking for plugin configurations - fixes #293
    • detect when plugin fails to load and fail the bot start because of it
    • detect failed nodebb login - resolves #294

  • Plugin & Theme Dev

    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!

    ā€‹
    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:
    ā€‹

    1. npm install -g sockbot
    2. npm install -g sockmafia
    3. 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
    
    1. 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.


  • Hey, I can not get sockbot to work with summoner. Can anything post an exemple config file that works. Please :s


  • Plugin & Theme Dev

    @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


  • Plugin & Theme Dev

    @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


  • Plugin & Theme Dev

    @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 or unknown on Windows depending on what OS the bot is running on (looks like Linux from your logs)

    0_1464808084661_upload-0edc89f2-57df-4179-9a82-9dafdf092644



  • Yes it shows up as unknown on Linux


  • Plugin & Theme Dev

    @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.


  • Plugin & Theme Dev

    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

  • Plugin & Theme Dev

    @UncleSam please install the new version and test. it should resolve your issue with the summoner plugin.


  • Plugin & Theme Dev

    @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


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.