damn

DeviantArt Message Network (chat) interface

npm install damn
18 downloads in the last week
36 downloads in the last month

dAmn.js

dAmn interface for node. You can use it to make bots.

Install

npm install damn

Begin

var dAmnJS = require('damn');

Authtokenstuff

To connect with username/password, do this:

var dAmn = new dAmnJS({
    username: 'pancakeman',
    password: 'secretwaffles'
});

dAmn.getToken(function(){
    //connect here
});

To connect with username/authtoken, do this:

var dAmn = new dAmnJS({
    username: 'pancakeman',
    authtoken: 'abcdefgandsoonandsoforth'
});

//connect here

Connecting

dAmn.connect(function(){
    //We're connected. Whoopdie-fucking-do.
    //now log in.
});

Logging in

dAmn.login();
dAmn.on('login_success', function(){
    //We're logged in. Fuck yeah.
});
dAmn.on('login_fail', function(){
    //Tis a sad day on earth, for we have failed to log in.
    //Many will mourn the anniversary of this moment for millennia to come.
});

Sending Packets

dAmn.action('#crappyroom', 'is so fucking out of here.');
dAmn.say('#crappyroom', 'Fuck this room, I hate it!');
dAmn.part('#crappyroom');

dAmn.join('#awesomeroom');

Receiving Packets

dAmn.on('join', function(room, e){
    if (e == 'ok'){
        console.log('Fuck yeah, I joined '+dAmn.deformChat(room)+'! This is the best fucking day of my life!');
        dAmn.say(room, 'I love this fucking room! '+room+' is the best fucking room ever!');
    } else {
        console.error('Failed to join '+dAmn.deformChat(room)+' ('+e+')');
    }
});

Hello, World!

var dAmnJS = require('dAmn');

var dAmn = new dAmnJS({
    username: 'username',
    password: 'password'
});

dAmn.getToken(function(){
    dAmn.connect(function(){
        dAmn.login();
        dAmn.on('login_success', function(){
            console.log('Yay, a successful login');
            dAmn.join('#DevelopingDevelopers');
            dAmn.on('join', function(room, e){
                if (e == 'ok'){
                    console.log('Joined '+dAmn.deformChat(room));
                    dAmn.say('#DevelopingDevelopers', 'Hello, World!');
                } else {
                    console.error('Failed to join '+dAmn.deformChat(room)+' ('+e+')');
                }
            });
        });
        dAmn.on('login_fail', function(){
            console.log('Nay, an unsuccessful login');
        });
    });
});

Also

nuckchorris0 wrote much of the code. I rewrote it to fix the following problems:

  • It sucked
  • It didn't work
  • It looked like shit
  • It made me want to die

Other than those things, though, it was pretty good stuff. Thanks, nuck.

npm loves you