Initial commit of TwittMUD, yo.
commit
99ccc692ba
|
@ -0,0 +1 @@
|
||||||
|
config.json
|
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
Binary file not shown.
After Width: | Height: | Size: 261 B |
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"consumer_key": "",
|
||||||
|
"consumer_secret": "",
|
||||||
|
"access_token": "",
|
||||||
|
"access_token_secret": ""
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
|
@ -0,0 +1,95 @@
|
||||||
|
/* TwittMUD - Twitter Multi-User Dungeon
|
||||||
|
````````````````````````````````````````````````````````````````````````````````
|
||||||
|
This is a weird program that runs a MUD from a Twitter account.
|
||||||
|
|
||||||
|
Tweet limit: 123 characters, due to 140 (max) - 17 ('@' + name max + ' ')
|
||||||
|
|
||||||
|
Tweet Transaction example:
|
||||||
|
a: You are in a white room. There is a painting. There are exits: north, east, west, south
|
||||||
|
b: @TwittMUD examine painting
|
||||||
|
a: The painting is by Rembrant, it looks expensive.
|
||||||
|
b: @TwittMUD take painting
|
||||||
|
a: You take the painting.
|
||||||
|
b: @TwittMUD south
|
||||||
|
a: You are on a balcony overlooking the ocean. There is a lighthouse. There are exits: north
|
||||||
|
*/
|
||||||
|
var Twit = require('twit');
|
||||||
|
var fs = require('fs');
|
||||||
|
/* ================ Core Program Data ================ */
|
||||||
|
var config = {};
|
||||||
|
var client = null;
|
||||||
|
var stream = null;
|
||||||
|
|
||||||
|
var vol = {
|
||||||
|
last_tweet_id: 0
|
||||||
|
};
|
||||||
|
/* ================ Main ================ */
|
||||||
|
var gogogo = function() {
|
||||||
|
try {
|
||||||
|
config = JSON.parse(fs.readFileSync("./config.json", "utf8"));
|
||||||
|
} catch(e) {
|
||||||
|
console.log(e);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
client = new Twit({
|
||||||
|
consumer_key: config.consumer_key,
|
||||||
|
consumer_secret: config.consumer_secret,
|
||||||
|
access_token: config.access_token,
|
||||||
|
access_token_secret: config.access_token_secret
|
||||||
|
});
|
||||||
|
stream = client.stream('user', {with: 'user'});
|
||||||
|
stream.on('follow', handleFollow);
|
||||||
|
stream.on('unfollow', handleUnfollow);
|
||||||
|
stream.on('tweet', handleTweet);
|
||||||
|
stream.on('error', handleError);
|
||||||
|
};
|
||||||
|
/* ================ Handler Functions (events, tweets, etc.) ================ */
|
||||||
|
/* handleTweet
|
||||||
|
Called on each tweet to this Twitter account.
|
||||||
|
*/
|
||||||
|
var handleTweet = function(tweet) {
|
||||||
|
vol.last_tweet_id = tweet.id;
|
||||||
|
// does the response match
|
||||||
|
var user = tweet.text.split
|
||||||
|
console.log(tweet);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
/* handleFollow
|
||||||
|
This function is called whenever the stream receives a 'follow' user event. This will trigger the activateUser for the given user_id.
|
||||||
|
*/
|
||||||
|
var handleFollow = function(event) {
|
||||||
|
console.log(event);
|
||||||
|
};
|
||||||
|
/* handleUnfollow
|
||||||
|
*/
|
||||||
|
var handleUnfollow = function(event) {
|
||||||
|
console.log(event);
|
||||||
|
};
|
||||||
|
/* handleError
|
||||||
|
*/
|
||||||
|
var handleError = function(event) {
|
||||||
|
console.log(err);
|
||||||
|
};
|
||||||
|
/* ================ Activity Functions (tweeting, etc.) ================ */
|
||||||
|
var tweetAt = function(user_id, tweet) {
|
||||||
|
|
||||||
|
};
|
||||||
|
var replyTweet = function(tweet_id, user_id, tweet) {
|
||||||
|
};
|
||||||
|
/* ================ User Activate/Deactivate Functions ================ */
|
||||||
|
/* activateUser
|
||||||
|
Removes the given user from the "Inactive Players" list and adds them to the "Active Players" list, thereby making them available for gameplay commands.
|
||||||
|
*/
|
||||||
|
var activateUser = function(user) {
|
||||||
|
};
|
||||||
|
/* deactivateUser
|
||||||
|
Removes the given user from the "Active Players" list and adds them to the "Inactive Players" list, thereby making them unavailable for gameplay commands. The user may still provide the "deactivate" or "restart" commands.
|
||||||
|
*/
|
||||||
|
var deactivateUser = function(user) {
|
||||||
|
};
|
||||||
|
/* deleteUser
|
||||||
|
Removes all user information - this is only ever emitted when the user unfollows @TwittMUD.
|
||||||
|
*/
|
||||||
|
var deleteUser = function(user) {
|
||||||
|
};
|
||||||
|
gogogo();
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"name": "TwittMUD",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "A multi-user dungeon system written for Twitter",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"MUD",
|
||||||
|
"twitter",
|
||||||
|
"server",
|
||||||
|
"engine"
|
||||||
|
],
|
||||||
|
"author": "kts of kettek <kettek1@kettek.net> (https://kettek.net/)",
|
||||||
|
"license": "GPLv3"
|
||||||
|
}
|
Loading…
Reference in New Issue