Language…
16 users online: caioskii, Dark Prince,  Deeke, Ekimnoid, ForthRightMC, Gamet2004, Gorry, JezJitzu, LadiesMan217, Mischievous Marc, neidoodle, NewPointless, Rauf, Raychu2021,  Ringo, The_Uber_Camper - Guests: 269 - Bots: 253
Users: 64,795 (2,375 active)
Latest user: mathew

YIBot, the IRC bot

Quote
[23:19:09] <sementa> YIBot is the best bot

This is my real C3 submission. Or perhaps I should've said, second day submission. It's an IRC bot which is totally useless and stuff (hint: it knows UNO). This is not version which I run on CaffieNET (the version on CaffieNET is insanely old and buggy). Unless you mean YIBotDev, but I don't think I run it for now on any bigger channels. By the way, this bot can run on multiple servers.

Well, it's finally time to release it. I was working to make it better and nearly useless. Because of nonexistent license agreements with Alcaro, this release doesn't include any SMW hacking thing. Don't ask me for it, it will probably not happen. It should be easy to implement any SMW hacking things, but this archive doesn't come with them.

To run this bot, you will need Node.js and CoffeeScript. The simplest way to install CoffeeScript would be to use npm (included with Node.js) and type npm install -g coffee-script.

First of all, I'm going to put download link thingy. The config file (config.sample.coffee) should be self-explaining. Please note that it depends on indentation (in certain places), so be careful while modifying it. When you will end modifying it, save it as config.coffee. Next, you can just run coffee yibot.coffee.

Hopefully, it was simple. Next part is making modules. The API is explained in server.coffee (it contains some logic, but it's mostly documentation, something like interface in Java). This bot supports two programming languages for modules, JavaScript (.js extension) and CoffeeScript (.coffee extension).

I know that examples are better, so let's me show small address converter made in JavaScript (also, I'm using automatic semicolon insertion, I actually like this JS feature).

Code
exports.addr = function () {
    var value = this.message.value
    if (value.charAt(0) === '$') {
        value = parseInt(value.substring(1), 16)
        if (value % 0x10000 < 0x8000) {
            this.respond('Invalid LoROM address!')
            return true
        }
        value %= 0x800000
        if (value >= 0x7E0000) {
            this.respond('This is RAM, you know?')
            return true
        }
        value = (value >> 16) * 0x8000 + 0x200
        this.respond('0x' + value.toString(16).toUpperCase())
        return true
    }
    else {
        value = parseInt(value, 16)
        if (value < 0x200) {
            this.respond('Welcome to the header!')
            return true
        }
        value += ((value - 0x200) >> 15) * 0x8000 + 0x7E00
        this.respond('$' + value.toString(16).toUpperCase())
        return true
    }
}

Simple, right? return true means don't parse further. Rest should be obvious (at least I hope so). Have fun making scripts :).

If you have any questions, feel free to post.