Commit f2bd4abd authored by Danny SMc's avatar Danny SMc

Initial Commit

parents
language: python
python:
- 3.3
- 2.7
install:
- if [[ $TRAVIS_PYTHON_VERSION == 2* ]]; then pip install -r requirements/python2.txt --use-mirrors; fi
- if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install -r requirements/python3.txt --use-mirrors; fi
script: nosetests
\ No newline at end of file
185.38.149.35:25578 - Proxy
185.38.148.138:25594 - Survival
185.38.148.138:25609 - Creative
\ No newline at end of file
/*
Name: ShinexusUK IRC Helper Bot:
Author: DannySMc & Max Thor (c) Copyright
Description:
This bot was made to help the channel: #shinexusuk to help connect with the main server, this includes functions to request details from the server itself, it was the main reason to get who is online, and even the MOTD.
*/
console.log("Running ShinexusUK Server Bot!");
var irc = require('irc'),
sys = require('sys'),
unirest = require('unirest'),
ex = require('child_process').exec,
child,
pre = "!";
console.log("Connecting to IRC Channel: #shinexusuk");
var bot = new irc.Client('irc.esper.net', 'ShinexusUK', {
channels: ['#shinexusuk'],
realName: 'ShinexusUK Server Bot',
autoRejoin: true
});
console.log("Connected!");
var proxy = "https://mcapi.us/server/status?ip=185.38.149.35&port=25578",
survival = "https://mcapi.us/server/status?ip=185.38.148.138&port=25594",
creative = "https://mcapi.us/server/status?ip=185.38.148.138&port=25609";
// Get server data
function getservers(name) {
if (name == "proxy") {
var Request = unirest.get(proxy);
Request.header('Accept', 'application/json').end(function (response) {
main = response["raw_body"];
data = JSON.parse(main);
console.log(data["motd"]);
return data.motd;
});
} else if (name == "creative") {
var Request = unirest.get(creative);
Request.header('Accept', 'application/json').end(function (response) {
main = response["raw_body"];
data = JSON.parse(main);
return data;
});
} else if (name == "survival") {
var Request = unirest.get(survival);
Request.header('Accept', 'application/json').end(function (response) {
main = response["raw_body"];
data = JSON.parse(main);
return data;
});
}
}
// Main logic:
function parsemessage(msg, to) {
// Execute files
function pu(o,t,f){if(o)throw o;if(f)throw f;bot.say(to,t)}
if (msg.substring(0,1) == pre) {
// Get array
msgs = msg.split(' ');
console.log(msgs[0]);
// Run Login
if (msgs[0] == pre+"help") {
bot.say(to, "Help & Commands can be found here: https://server.dannysmc.com/bots.html");
} else if (msgs[0] == pre+"status") {
// Get status of server, should return online/offline - player count for each server - motd
server = getservers("proxy");
console.log(server);
/*var data = '';
var Request = unirest.get('https://mcapi.us/server/status?ip=185.38.149.35&port=25578');
Request.header('Accept', 'application/json').end(function (response) {
main = response["raw_body"];
data = JSON.parse(main);
});
console.log(data);
console.log(data.players.now);
//bot.say(to, data.players.now.toString());
bot.say(to, data.toString());
console.log("Finished!");*/
} else if (msgs[0] == pre+"players") {
// Should return the player list for each server
} else if (msgs[0] == pre+"motd") {
// Should return the message of the day.
} else if (msgs[0] == pre+"ip") {
bot.say(to, "ShinexusUK IP Address: shinexusuk.nitrous.it");
} else if (msgs[0] == pre+"rules") {
}
}
}
// Listen for joins
bot.addListener("join", function(channel, who) {
// Welcome them in!
bot.say(channel, who + ": Welcome to ShinexusUK, I am an automated helper bot, do "+pre+"help for options.");
});
// Listen for any message, PM said user when he posts
bot.addListener("message", function(from, to, message) {
//bot.say(to, "Processing...");
parsemessage(message, to);
});
// Prevent crashes
process.on('uncaughtException', function(err){
console.error(err.stack);
console.log("Node NOT Exiting.");
});
\ No newline at end of file
{
"validateIndentation": 4,
"requireMultipleVarDecl": null,
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
"safeContextKeyword": "self"
}
npm-debug.log
node_modules/
_build/
.idea/
language: node_js
node_js:
- "0.10"
- "0.8"
before_install:
- sudo apt-get -y install libicu-dev
- npm install -g npm
script:
- "npm run-script lint"
- "npm test"
notifications:
irc: "chat.freenode.net##node-irc"
# 0.3.8 to 0.3.9 (2015-01-16)
## Added
* Included notes in the README about icu / iconv
* First draft of contributor doc!
* Log network connection errors
* This changelog
## Changed
* Factored out parseMessage for better decoupling
* Turn off autorejoin on kicks
* Factored out test data to fixtures
* Moved to irc-colors for stripping colors
## Fixed
* Fixed line split delimiter regex to be more correct and robust
* Fixed issue where self.hostMask may not be set when the client's nick is in use
* Fixed hostmask length calculation--n.b., some ircds don't give the full hostmask
* Style cleanups
* Fixed SSL
# 0.3.7 to 0.3.8 (2015-01-09)
## Added
* Added support for binding to a specific local address
* WEBIRC support
## Changed
* Various small changes and fixes
## Fixed
* Proper line wrapping
* Fixed bold and underline codes
# Contributing to node-irc
First, and most importantly, thank you for contributing to node-irc! Your efforts make the library
as awesome as it is, and we really couldn't do it without you. Through your pull requests, issues,
and discussion, together we are building the best IRC library for node. So, once again, *thank you*!
What follows is a set of guidelines for contributing to node-irc. We ask that you follow them
because they make our lives as maintainers easier, which means that your pull requests and issues
have a higher chance of being addressed quickly. Please help us help you!
This guide is roughly based on the [Atom contributor's guide](https://github.com/atom/atom/blob/master/CONTRIBUTING.md), so thanks to the Atom team for
providing such a solid framework on which to hang our ideas.
# Submitting Issues
* Include the version of node-irc, or the SHA1 from git if you're using git.
* Include the behavior you expect, other clients / bots where you've seen that behavior, the
observed behavior, and details on how the two differ if it's not obvious.
* Enable debug mode for node-irc and include its output in your report.
* In the case of a crash, include the full stack trace and any error output.
* Perform a cursory search to see if similar issues or pull requests have already been filed, and
comment on them to move the discussion forward.
* Most importantly, provide a minimal test case that demonstrates your bug. This is the best way
to help us quickly isolate and fix your bug.
* Consider joining us on IRC (##node-irc on freenode) for realtime discussion. Not only is it a
friendly gesture, it also helps us isolate your issue far more quickly than the back-and-forth of
issues on github allows.
# Pull requests
* Add yourself to the contributors section of package.json to claim credit for your work!
* Do your work on a branch from master and file your pull request from that branch to master.
* Make sure your code passes all tests (`npm run test; npm run lint`).
* If possible, write *new* tests for the functionality you add. Once we have sane testing in place,
this will become a hard requirement, so it's best to get used to it now!
* If you change any user-facing element of the library (e.g. the API), document your changes.
* If you make *breaking* changes, say so clearly in your pull request, so we know to schedule the
merge when we plan to break the API for other changes.
* Squash your commits into one before issuing your pull request. If you are not sure how to do this,
take a look at the [edx instructions](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) and change the
obvious things to apply to your node-irc fork. If this doesn't make sense, or you're having trouble,
come talk to us on IRC! We'll be glad to walk you through it.
* End files with a newline.
# Commit messages
* Use the present tense ("Add feature" not "Added feature").
* Use the imperative mood ("Change message handling..." not "Changes message handling...").
* Limit the first line to 72 characters or less.
* Reference issues and pull requests liberally.
This diff is collapsed.
[![](https://img.shields.io/travis/martynsmith/node-irc.svg?style=flat)](https://travis-ci.org/martynsmith/node-irc)
[node-irc](http://node-irc.readthedocs.org/) is an IRC client library written in [JavaScript](http://en.wikipedia.org/wiki/JavaScript) for [Node](http://nodejs.org/).
You can access more detailed documentation for this module at [Read the Docs](http://readthedocs.org/docs/node-irc/en/latest/)
## Installation
The easiest way to get it is via [npm](http://github.com/isaacs/npm):
```
npm install irc
```
If you want to run the latest version (i.e. later than the version available via
[npm](http://github.com/isaacs/npm)) you can clone this repo, then use [npm](http://github.com/isaacs/npm) to link-install it:
```
npm link /path/to/your/clone
```
Of course, you can just clone this, and manually point at the library itself,
but we really recommend using [npm](http://github.com/isaacs/npm)!
Note that as of version 0.3.8, node-irc supports character set detection using
[icu](http://site.icu-project.org/). You'll need to install libiconv (if
necessary; Linux systems tend to ship this in their glibc) and libicu (and its
headers, if necessary) in order to use this feature.
## Basic Usage
This library provides basic IRC client functionality. In the simplest case you