GithubHelp home page GithubHelp logo

servicenowdevprogram / slackerbot Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 73.0 700 KB

The official application repository for the bot @Slacker on the sndevs.com workspace.

Home Page: https://github.com/ServiceNowDevProgram/Hacktoberfest

JavaScript 100.00%
hacktoberfest hacktoberfest-accepted hacktoberfest2022 servicenow hacktoberfest2023 slack

slackerbot's Introduction

SlackerBot Banner

This bot is what controls the @Slacker bot on the sndevs.com workspace.

๐Ÿ””๐Ÿ””๐Ÿ””
CONTRIBUTORS must follow all guidelines in CONTRIBUTING.md or run the risk of having your Pull Requests labeled as spam.
๐Ÿ””๐Ÿ””๐Ÿ””

Contents

Ideas

See the Issues tab for parser ideas. Make sure to leave a comment on an issue if you're working on it.

Two ways to contribute

Easy or Hard

Easy method (Adding new parser)

Can be done without pulling this app into a ServiceNow instance.
This is the preferred method for adding simple call & response parsers (see Bowtie when chuck is mentioned, or Clap Back for examples)

  1. Fork this repo
  2. Create a new branch (name it according to what functionality you are adding)
  3. Create a new .js file in the Parsers folder (see CONTRIBUTING.md for requirements)
  4. Submit a pull request to the ServiceNowDevProgram/SlackerBot main branch

If approved, your new parser automatically goes live for the bot's immediate use!


Hard method (Adding new functionality types)

This method requires more setup, but is the preferred method for more complex parsers and functionalities, as it provides a method to robustly test before submitting a pull request.

  1. Fork this repo
  2. Go to your ServiceNow instance
  3. Go to System Applications => Studio
  4. Once Studio loads, select Import From Source Control
  5. Use your forked repo to Import your application
  6. Optional: See below on how to get this bot working on your own slack server
  7. Make updates to the application (see CONTRIBUTING.md for additional details)
  8. In Studio, commit your changes to source control
  9. Submit a pull request to the ServiceNowDevProgram/SlackerBot main branch

An accepted Pull Request and merge does not necessarily mean the functionality will go live immediately, as an admin for the host instance will need to pull the application into ServiceNow.

Installing this bot on your own workspace

Create App and Install it

Via a Manifest

When you tab out of the field, make sure the URL is "Verified" before you proceed.

  • Navigate to Settings > Install App
  • Click the Install to Workspace button
  • Verify the view and do permissions
  • Click the Allow button
  • Copy the Bot User OAuth Token for the ServiceNow system property configuration later

Manually

When you tab out of the field, make sure the URL is "Verified" before you proceed.

  • Expand the Subscribe to bot events section
  • Click the Add bot User Event button
  • Search for and select message.channels
  • Search for and select message.groups
  • Click the Save Changes button
  • Navigate to Features > OAuth & Permissions
  • Scroll down to Bot Token Scopes
  • Click the Add an OAuth Scope button
  • Search for and select chat:write
  • Navigate to Settings > Install App
  • Click the Install to Workspace button
  • Verify the view and do permissions
  • Click the Allow button
  • Copy the Bot User OAuth Token for the ServiceNow system property configuration later

Connect them together

  • Place token into the ServiceNow system property 'x_snc_slackerbot.SlackerBot.token'
    • REMINDER: When you commit your changes, always delete the value of this property before you commit. If you forget to do this, the token will automatically be disabled GitHub sees that you accidentally placed your private token online. If this happens, go into your app and issue a new token.

Testing

  • Invite your bot to a channel
  • Create a parser on the x_snc_slackerbot_parser table
  • Trigger the parser in the channel

Troubleshooting

  • Check the Payload x_snc_slackerbot_payload table to make sure SN is receiving messages
  • Check 'Outbound HTTP Requests' to make sure the bot is replying to the channel

GitHub to ServiceNow Integrations

Auto populate your Parsers table

To fill your Parsers x_snc_slackerbot_parser table with all the parsers that exist on this repo:

  • Go to the Parsers table list (type x_snc_slackerbot_parser.list in your filter navigator and press enter)
  • Click on the "Sync Parsers" Banner UI Action

This syncs your table to this repo, if you rather sync it to another repo, change the value of your x_snc_slackerbot.Parsers_Sync_Repo system property.

Setting up the GitHub to ServiceNow integration

The Parsers folder on ServiceNowDevProgram/SlackerBot is set up to send changes to the ServiceNow instance that @Slacker is hosted on (automatically, on every commit). To do this for your own fork and ServiceNow instance:

  • In your forked repository, click on the Actions tab
  • Click on "I understand" to activate workflows
  • Go to the Settings tab
  • Under Secrets and Actions add the following repository secrets:
    • SN_INSTANCE_NAME your ServiceNow instance name
    • ADMIN_USERNAME the username of an admin account on your ServiceNow instance
    • ADMIN_PASSWORD the password of the above account

Testing

  • Create a new file in the Parsers folder and name it something.js
  • Follow the template in the CONTRIBUTING.md document
  • Commit the file
  • Check your ServiceNow instance on the Parsers x_snc_slackerbot_parser table and verify the file was uploaded
  • Trigger the parser on a channel that your bot is in

Notes for setting this app up in ServiceNow Studio

Never commit your tokens to GitHub

System Properties

  • x_snc_slackerbot.SlackerBot.token is your bot's user token. Required to send messages back to your workspace
  • x_snc_slackerbot.SlackerBot.supertoken is any admin token for your server. Used for deleting messages (see in-app SRAPI).
  • x_snc_slackerbot.maps.token is your Google Maps token (if you wish to use the !iss parser)

Scripted Rest APIs (SRAPIs)

  • SlackerBot Event Handler is used to validate to the Events handler and to convert incoming chats to the x_snc_slackerbot_payload table
  • SlackerBotGitHub is used to automate the creation of parsers from ServiceNowDevProgram/SlackerBot/Parsers

Available APIs/variables in parsers

  • current.text the entire text of the chat that is being parsed
  • current.ts the timestamp of the chat
  • current.thread_ts if the chat was in a thread, the original message's timestamp
  • current.channel the channel's unique ID that the chat was sent in
  • current.user.user_id the chat's sender's unique ID
  • current.user.name the chat's sender's display name
  • new x_snc_slackerbot.Slacker().send_chat(param 1, param 2, param 3) How to send chats back to your workspace after parsing.
    • param 1 Required reference object. The gliderecord that contains the channel and timestamps. Should almost always be current
      • If you do not have a gliderecord, this can be faked by providing a JSON object. The only key that is required is a channel, eg. {"channel":"ABC123"}
    • param 2 Required string or object
      • Required string. The chat message to be sent as plaintext. Can be an expression, eg. originalNumber + ' is the result.
      • Required object. The chat content to be sent, as per the Block Kit API format. Object requires text and blocks properties. See Block Kit API Reference
        • Example Object:
{
	"text": "",
	"blocks": [
		{ "type": "header", "text": { "type": "plain_text", "text": "Exemplar" } }
	]
}
  • param 3 Optional boolean. If set to true, will always push chat to the thread instead of to the main channel chat. Useful if param 2 is expected to be long and you don't want to flood chat. Defaults to false if not provided.
  • new x_snc_slackerbot.Slacker().send_reaction(param 1, param 2) How to send reactions back to a specific chat after parsing.
    • param 1 Required reference object. The gliderecord that contains the channel and timestamps. Should almost always be current
      • If you do not have a gliderecord, this can be faked by providing a JSON object. Both the channel and ts keys are required. {"channel":"ABC123","ts":"0123456789"}
    • param 2 Required string. The name of the emoji to send. Do not include surrounding :. Eg. joy and not :joy:

slackerbot's People

Contributors

404paige avatar aatrey882 avatar ajcooper72 avatar almajam avatar aykmrgit avatar chelming avatar davidarthurcole avatar davidmarcial avatar djunaid avatar earlduque avatar earlduquesn avatar eriemer1 avatar gauthambellamkonda avatar goranlundqvist avatar hrichiksite avatar ishaanshoor avatar jayden-chiu avatar johndahl-now avatar ladirinia avatar mgopw avatar mjonssonme avatar mr-swann avatar mrsinghrajat avatar mrswann avatar niamccash avatar raunakscarlet avatar sapphicfire avatar sisco0 avatar snamjosh avatar wiz0floyd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

slackerbot's Issues

Re-organize duplicated content in readme and contributing

The two documentation files currently have duplicated sections that appear in both, this should probably be fixed so that contributors dont get confused.

Readme probably should have almost everything from description to apis and installation instructions. While contributing has only requirements for contributors to get their pull requests approved.

Maybe verify that split is standard best practice for GitHub

Add order and stop_processing to parsers table

Add an order (integer) and stop_processing_after_executing (true/false) fields to the parsers table and edit the chat parser and react parser business rules to abide by these fields:
parsers execute in order from lower to higher then blank, and if stop_processing is true, break the loop.

Create an !ice breaker parser

something like: when someone says !ice breaker, the bot responds with a random "get to know each other" prompt.
example responses

  • how many siblings do you have,
  • what's your favorite movie,
  • what do you do for fun,
  • would you rather fight 100 duck-sized horses or 1 horse-sized duck?

Create a !downdetector Parser

  • When only !downdetector is passed, make use of the Down Detector API to return a list of the most notable "currently down" sites
  • When a term is passed slack, discord, netflix, etc., check to see if the page exists (e.g. https://downdetector.com/status/netflix/). If it does, link to the page. If not, link to https://downdetector.com/search/?q=${term}

There's probably some more cool stuff that can be done with this one, given they've got a fairly open API.

Recreate the very important parser for !ajb

old script:

(function executeRule(current, previous /*null when async*/) {
	//var random = Math.floor(Math.random() * 1000);
	var choices = [
		':ajb:',
		':partyajb:',
		':mobilityajb:',
		':ajbconga:',
		':ajbgoespoof:',
		':ajbleftfall:',
		':ajbdownfall:',
		':ajbispumped:',
		':ajbdescends:',
		':ajbupsidedown:',
		':ajbheadswillroll:'
	];
	var split = parseInt(current.text.split(' ')[1]);
	var text = choices.join(' ');
	if (parseInt(split) > 0 && parseInt(split) <= 10){
		while (split > 1){
			text += ' ' + choices.join(' ');
			split--;
		}
	} else if (parseInt(split) > 10){
		text = 'Now that would just be rude. Shame on you';
	}
	var send_chat = new SlackFall().send_chat(current.channel, text, false, '' , current.thread_ts);
})(current, previous);

Add emoji react parser for :welcome:

In the previous version of the bot, the :welcome: emoji would send this in a DM, let's do it in a thread instead since the new bot doesn't have DM capability yet:

  • emoji:welcome
  • send in thread always

To prevent spam, parser query query the payload table to see if this has already been activated, and if so, don't run.

previous text:

var message = ['Hello! <@'+payload.event.user+'> asked that I give you these helpful tips as a welcome to the community.',''];
	
	message.push('*How do I ask a good question?*');
	message.push('โ€ข Use Threads! #general gets busy so make sure to keep conversation about your question in the original thread.');
	message.push('');
	message.push('Write a title that summarizes the specific problem');
	message.push('โ€ข Pretend you\'re talking to a busy colleague');
	message.push('โ€ข Spelling, grammar, and punctuation are important!');
	message.push('โ€ข Bad: GlideRecord isn\'t working');
	message.push('โ€ข Good: Why does str == "value" evaluate to false when str is set to "value" in my script?');
	message.push('');
	message.push('โ€ข Introduce the problem before you post any code');
	message.push('โ€ข Help others reproduce the problem. Don\'t just copy in your entire script!');
	message.push('โ€ข Do not post images of code, data, error messages (just copy the text)');
	message.push('โ€ข When posting code wrap it in 1x and 3x back-tick [`] syntax, or use the code editor.');
	message.push('  โ€ข |`your text` = Red highlighted single-line|');
	message.push('  โ€ข |```your text``` = Grey highlighted multi-line|');
	message.push('  โ€ข Or use the </> code button on the text editor in slack.');
	message.push('โ€ข Proof-read before posting!');
	message.push('โ€ข Post the question and respond to feedback');
	message.push('');
	message.push('*Give points to people who are helpful!*');
	message.push('If someone successfully helped you (or ever just help you got closer to the answer) tag them with a ++ in the thread. eg. <@' + payload.event.user + '> ++ will grant that user some community points to show how helpful they were');
	message.push('');
	message.push('Looking for more helpful tips? These tips are mostly from https://stackoverflow.com/help/how-to-ask');

Recreate parser for !trout

old script:

(function executeRule(current, previous /*null when async*/) {

	var regex = /^\!trout/gmi;
	var term = '';

		if (current.text.indexOf('!slap') > -1){
			term = current.text.substr(5).trim();
		} else {
			term = current.text.substr(7).trim();
		}
		if (term == '') {
			var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: !trout *something*', false, '', current.thread_ts);
			return;
		}
		var send_chat = new SlackFall().send_chat(current.channel, '<@'+current.user.user_id+'> slapped ' + term + ' with a large trout', false, '', current.thread_ts);


})(current, previous);

Update the readme.md file

Slack has updated the process to create new apps.

  • The step to "Add a user bot" is no longer required.
  • The permissions given to the user bot are simply chat:write

Recreate parser for !tips

old script:

(function executeRule(current, previous /*null when async*/) {
	var message = "1. Use Threads (when busy or when quiet)\n     โ€ข Start your own thread with :thread:\n     โ€ข Use #pastebin for images in thread\n2. Wrap your code in 1x and 3x back-tick syntax\n     โ€ข Surround text with ` = Red highlighted single-line\n     โ€ข Surround text with ``` = Grey highlighted multi-line\n3. Give points for helpful responses @name ++\n     โ€ข You can give points in a thread\n     โ€ข You can give multiple people points in a single comment\n     โ€ข Fine print: @points_thing bot needs to be present in the channel\n4. Don't ask if you can ask a question, just ask it.\n5. See if there is a #channel for your topic, experts like to hang in channels they are experts in\n6. If you have a code question, be prepared to share your code\n7. Notifications\n     โ€ข you can keywords to notify you in your slack preferences\n     โ€ข you can mute channels you want access to, but dont need immediate Notifications\n     โ€ข you can have separate desktop / mobile notifiations configs";
	var send_chat = new SlackFall().send_chat(current.channel, message, false, '', current.thread_ts);
})(current, previous);

Recreate parser for !bang

old script:

(function executeRule(current, previous /*null when async*/) {

	var term = current.text.split(' ')[1].trim();
	if (!term) {
		var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: !bang *someone*', false, '', current.thread_ts);
		return;
	}
	var send_bang = new SlackFall().send_chat(current.channel, 'Hey ' + term + ', you\'ve had a bang-up past couple of months. Hope people start respecting you and your hard work.', false, '', current.thread_ts);


})(current, previous);

Recreate parser for !jitsi

old script:

(function executeRule(current, previous /*null when async*/) {

	var regex = /^(!jitsi|!meet|!call)/gmi;

	if (regex.test(current.text)){
		var term = '';
		if (current.text == '!jitsi' || current.text == '!meet' || current.text == '!call'){
			term = current.user.name.replace(' ','_') || 'nothing';
		}
			else term = current.text.replace('!jitsi', '').replace('!meet', '').replace('!call', '').trim().replace(/ /gmi,'_');
		var send_chat = new SlackFall().send_chat(current.channel, 'Click to join: https://meet.jit.si/sndevs/' + term + ' Use Chrome, or Jitsi Meet App on IOS/Android - Room `sndevs/' + term + '`', false, '', current.thread_ts);
	}


})(current, previous);

Add a limit to the Lorem Ipsum generator

The Lorem Ipsum generator does not currently have any limits defined so a user could flood a thread with generated content. Add limits to keep the responses to one Slack message.

Limit to:

  • 5 paragraphs
  • 500 words
  • 5000 bytes

Create a new parser for Caesar Cypher

A new parser could be created for using Caesar Cypher (ROT13 Shift).
The new parser could be triggered by the use of the !caesar token followed by the phrase to encrypt. An example case is shown below:

User> !caesar hello world!
Bot > uryyb jbeyq!

Recreate parser for !parrotwave

old script:

(function executeRule(current, previous /*null when async*/) {
	var random = Math.floor(Math.random() * 100000);
	var regex = /(parrot wave)|(parrotwave)|(wave parrot)|(waveparrot)|(parrot party)|(parrotparty)/gmi;
	if (random == 1 || regex.test(current.text) || current.thread_ts == '1591314666.124000') { // CAQ2W3EE4 GD51HTR46
		var send_reaction1 = new SlackFall().send_reaction(current.channel,'parrotwave1',current.ts);
		var send_reaction2 = new SlackFall().send_reaction(current.channel,'parrotwave2',current.ts);
		var send_reaction3 = new SlackFall().send_reaction(current.channel,'parrotwave3',current.ts);
		var send_reaction4 = new SlackFall().send_reaction(current.channel,'parrotwave4',current.ts);
		var send_reaction5 = new SlackFall().send_reaction(current.channel,'parrotwave5',current.ts);
		var send_reaction6 = new SlackFall().send_reaction(current.channel,'parrotwave6',current.ts);
		var send_reaction7 = new SlackFall().send_reaction(current.channel,'parrotwave7',current.ts);
		if (random == 1) var send_chat = new SlackFall().send_chat('slackoff-dev-p', 'The rare parrot wave appeared! <#'+current.channel+'> https://sndevs.slack.com/archives/'+current.channel+'/'+current.ts, false);
	}
})(current, previous);

Recreate parser for !pride

old script:

(function executeRule(current, previous /*null when async*/) {

	var regex = /(happy pride)|(!pride)|(pride month)/gmi;
	if (regex.test(current.text)) { // CAQ2W3EE4 GD51HTR46
		var send_reaction1 = new SlackFall().send_reaction(current.channel,'pride_heart',current.ts);
		var send_reaction2 = new SlackFall().send_reaction(current.channel,'bi_pride',current.ts);
		var send_reaction3 = new SlackFall().send_reaction(current.channel,'pan_pride',current.ts);
		var send_reaction4 = new SlackFall().send_reaction(current.channel,'asexuality_pride',current.ts);
		var send_reaction5 = new SlackFall().send_reaction(current.channel,'demigirl_pride',current.ts);
		var send_reaction6 = new SlackFall().send_reaction(current.channel,'trans_pride',current.ts);
		var send_reaction7 = new SlackFall().send_reaction(current.channel,'nonbinary_pride',current.ts);
		var send_reaction8 = new SlackFall().send_reaction(current.channel,'agender_pride',current.ts);
		var send_reaction9 = new SlackFall().send_reaction(current.channel,'genderfluid_pride',current.ts);
		var send_reaction10 = new SlackFall().send_reaction(current.channel,'genderqueer_pride',current.ts);
		var send_reaction11 = new SlackFall().send_reaction(current.channel,'intersex_pride',current.ts);
		//if (random == 1) var send_chat = new SlackFall().send_chat('slackoff-dev-p', 'The rare parrot wave appeared! <#'+current.channel+'> https://sndevs.slack.com/archives/'+current.channel+'/'+current.ts, false);
	}
})(current, previous);

Add emoji react for :trebek:

  • emoji:trebek
  • always send in thread

previous code:

new SlackFall().send_chat(payload.event.item.channel, 'http://www.quickmeme.com/img/b0/b0bf18d80b3fc08e45b6d3421377591d1077a3c983f75b10fa6c94934002eb09.jpg?' + new GlideDateTime().getNumericValue(), false, '', ts); 
//a time signature is added to the URL so that Slack interprets each picture as a different picture (repeated pictures don't unfurl)

Add base functionality to allow for emoji reacts to trigger parsers

old script:

(function executeRule(current, previous /*null when async*/) {

	var payload = JSON.parse(current.payload);
	if (payload.event.type == 'reaction_added' && payload.event.reaction == 'parrotwave1') {
		var send_reaction2 = new SlackFall().send_reaction(payload.event.item.channel,'parrotwave2',payload.event.item.ts);
		var send_reaction3 = new SlackFall().send_reaction(payload.event.item.channel,'parrotwave3',payload.event.item.ts);
		var send_reaction4 = new SlackFall().send_reaction(payload.event.item.channel,'parrotwave4',payload.event.item.ts);
		var send_reaction5 = new SlackFall().send_reaction(payload.event.item.channel,'parrotwave5',payload.event.item.ts);
		var send_reaction6 = new SlackFall().send_reaction(payload.event.item.channel,'parrotwave6',payload.event.item.ts);
		var send_reaction7 = new SlackFall().send_reaction(payload.event.item.channel,'parrotwave7',payload.event.item.ts);
	}

})(current, previous);

Recreate parser for !lmgtfy

old script:

(function executeRule(current, previous /*null when async*/) {

	var where = 0;
	var which = '';
	if (current.text.indexOf('!lmgtfy') > -1) {
		where = current.text.indexOf('!lmgtfy') + 8;
		which = 'lmgtfy';
	} else if (current.text.indexOf('!google') > -1){
		where = current.text.indexOf('!google') + 8;
		which = 'google';
	} else {
		return;
	}

	var term = current.text.substr(where).trim();
	if (term == '') {
		var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: !docs *something*', false, '', current.thread_ts);
		return;
	}
	if (which == 'lmgtfy') var send_lmgtfy = new SlackFall().send_chat(current.channel, 'http://lmgtfy.com/?q=' + escape(term), false, '', current.thread_ts);
	else if (which == 'google') var send_google = new SlackFall().send_chat(current.channel, 'https://www.google.com/search?q=' + escape(term), false, '', current.thread_ts);



})(current, previous);

Recreate admin parser for !whois

old script:

(function executeRule(current, previous /*null when async*/) {

	var rm = new sn_ws.RESTMessageV2();
	rm.setHttpMethod('GET');
	rm.setLogLevel('all');
	rm.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	var bodyString = '';
	bodyString += 'token=' + gs.urlEncode(gs.getProperty('x_165574_slackoff.slackbot.token'));
	var user_id = current.text;
	user_id = user_id.replace('!whois <@', '');
	user_id = user_id.replace('>', '');
	bodyString += '&user=' + gs.urlEncode(user_id);
	rm.setEndpoint('https://slack.com/api/users.info'+'?'+bodyString);
	//rm.setRequestBody(bodyString);
	var response = rm.execute();
	var response_body = JSON.parse(response.getBody());
	//gs.info('slackoff error: ' + response_body.error);
	
	var message_body = '';
	for (var key in response_body.user){
		if (key == 'profile') {
			message_body += 'profile: \n';
			for (var prof_key in response_body.user.profile) {
				if (prof_key.indexOf('image_') != -1) continue;
				message_body += '  ' + prof_key + ': ' + response_body.user.profile[prof_key] + '\n';
			}
		} else message_body += key + ': ' + response_body.user[key] + '\n';
	}

	if (response_body.user.name){
		var send_chat = new SlackFall().send_chat(current.channel, '```' + message_body + '```', false, '', current.ts);
	} else {
		var send_chat2 = new SlackFall().send_chat(current.channel, 'i dunno', false, '', current.ts);
	}

})(current, previous);

Recreate the parser for !joke

old script:

I am seeking both a mentee to mentor and(function executeRule(current, previous /*null when async*/) {

	var regex = /(!joke)/gmi;
	if (regex.test(current.text)) {

		var jokes = [
			{
				"joke": "What did the fish say when it hit the wall?",
				"punchline": "Dam."
			}, {
				"joke": "How do you make a tissue dance?",
				"punchline": "You put a little boogie on it."
			}, {
				"joke": "What's Forrest Gump's password?",
				"punchline": "1Forrest1"
			}, {
				"joke": "What do you call a belt made out of watches?",
				"punchline": "A waist of time."
			}, {
				"joke": "Why can't bicycles stand on their own?",
				"punchline": "They are two tired"
			}, {
				"joke": "How does a train eat?",
				"punchline": "It goes chew, chew"
			}, {
				"joke": "What do you call a singing Laptop",
				"punchline": "A Dell"
			}, {
				"joke": "How many lips does a flower have?",
				"punchline": "Tulips"
			}, {
				"joke": "How do you organize an outer space party?",
				"punchline": "You planet"
			}, {
				"joke": "What kind of shoes does a thief wear?",
				"punchline": "Sneakers"
			}, {
				"joke": "What's the best time to go to the dentist?",
				"punchline": "Tooth hurty."
			}, {
				"type": "knock-knock",
				"joke": "Knock knock. \n Who's there? \n A broken pencil. \n A broken pencil who?",
				"punchline": "Never mind. It's pointless."
			}, {
				"type": "knock-knock",
				"joke": "Knock knock. \n Who's there? \n Cows go. \n Cows go who?",
				"punchline": "No, cows go moo."
			}, {
				"type": "knock-knock",
				"joke": "Knock knock. \n Who's there? \n Little old lady. \n Little old lady who?",
				"punchline": "I didn't know you could yodel!"
			}, {
				"joke": "What's the best thing about a Boolean?",
				"punchline": "Even if you're wrong, you're only off by a bit."
			}, {
				"joke": "What's the object-oriented way to become wealthy?",
				"punchline": "Inheritance"
			}, {
				"joke": "Where do programmers like to hangout?",
				"punchline": "The Foo Bar."
			}, {
				"joke": "Why did the programmer quit his job?",
				"punchline": "Because he didn't get arrays."
			}, {
				"joke": "Did you hear about the two silk worms in a race?",
				"punchline": "It ended in a tie."
			}, {
				"joke": "What do you call a laughing motorcycle?",
				"punchline": "A Yamahahahaha."
			}, {
				"joke": "A termite walks into a bar and says...",
				"punchline": "'Where is the bar tended?'"
			}, {
				"joke": "What does C.S. Lewis keep at the back of his wardrobe?",
				"punchline": "Narnia business!"
			}, {
				"joke": "Why do programmers always mix up Halloween and Christmas?",
				"punchline": "Because Oct 31 == Dec 25"
			}, {
				"joke": "A SQL query walks into a bar, walks up to two tables and asks...",
				"punchline": "'Can I join you?'"
			}, {
				"joke": "How many programmers does it take to change a lightbulb?",
				"punchline": "None that's a hardware problem"
			}, {
				"joke": "If you put a million monkeys at a million keyboards, one of them will eventually write a Java program",
				"punchline": "the rest of them will write Perl"
			}, {
				"joke": "['hip', 'hip']",
				"punchline": "(hip hip array)"
			}, {
				"joke": "To understand what recursion is...",
				"punchline": "You must first understand what recursion is"
			}, {
				"joke": "There are 10 types of people in this world...",
				"punchline": "Those who understand binary and those who don't"
			}, {
				"joke": "What did the duck say when he bought lipstick?",
				"punchline": "Put it on my bill"
			}, {
				"joke": "What happens to a frog's car when it breaks down?",
				"punchline": "It gets toad away"
			}, {
				"joke": "did you know the first French fries weren't cooked in France?",
				"punchline": "they were cooked in Greece"
			}, {
				"joke": "Which song would an exception sing?",
				"punchline": "Can't catch me - Avicii"
			}, {
				"type": "knock-knock",
				"joke": "Knock knock. \n Who's there? \n Opportunity.",
				"punchline": "That is impossible. Opportunity doesn't come knocking twice!"
			}, {
				"joke": "Why do Java programmers wear glasses?",
				"punchline": "Because they don't C#"
			}, {
				"joke": "Why did the mushroom get invited to the party?",
				"punchline": "Because he was a fungi."
			}, {
				"joke": "Why did the mushroom get invited to the party?",
				"punchline": "Because he was a fungi."
			}, {
				"joke": "I'm reading a book about anti-gravity...",
				"punchline": "It's impossible to put down"
			}, {
				"joke": "If you're American when you go into the bathroom, and American when you come out, what are you when you're in there?",
				"punchline": "European"
			}, {
				"joke": "Want to hear a joke about a peice of paper?",
				"punchline": "Never mind...it's tearable"
			}, {
				"joke": "I just watched a documentary about beavers.",
				"punchline": "It was the best dam show I ever saw"
			}, {
				"joke": "If you see a robbery at an Apple Store...",
				"punchline": "Does that make you an iWitness?"
			}, {
				"joke": "A ham sandwhich walks into a bar and orders a beer. The bartender says...",
				"punchline": "I'm sorry, we don't serve food here"
			}, {
				"joke": "Why did the Clydesdale give the pony a glass of water?",
				"punchline": "Because he was a little horse"
			}, {
				"joke": "If you boil a clown...",
				"punchline": "Do you get a laughing stock?"
			}, {
				"joke": "Finally realized why my plant sits around doing nothing all day...",
				"punchline": "He loves his pot."
			}, {
				"joke": "Don't look at the eclipse through a colander.",
				"punchline": "You'll strain your eyes."
			}, {
				"joke": "I bought some shoes from a drug dealer.",
				"punchline": "I don't know what he laced them with, but I was tripping all day!"
			}, {
				"joke": "Why do chicken coops only have two doors?",
				"punchline": "Because if they had four, they would be chicken sedans"
			}, {
				"joke": "What do you call a factory that sells passable products?",
				"punchline": "A satisfactory"
			}, {
				"joke": "When a dad drives past a graveyard: Did you know that's a popular cemetery?",
				"punchline": "Yep, people are just dying to get in there"
			}, {
				"joke": "Why did the invisible man turn down the job offer?",
				"punchline": "He couldn't see himself doing it"
			}, {
				"joke": "How do you make holy water?",
				"punchline": "You boil the hell out of it"
			}, {
				"joke": "I had a dream that I was a muffler last night.",
				"punchline": "I woke up exhausted!"
			}, {
				"joke": "Why is peter pan always flying?",
				"punchline": "Because he neverlands"
			}, {
				"joke": "How do you check if a webpage is HTML5?",
				"punchline": "Try it out on Internet Explorer"
			}, {
				"joke": "What do you call a cow with no legs?",
				"punchline": "Ground beef!"
			}, {
				"joke": "I dropped a pear in my car this morning.",
				"punchline": "You should drop another one, then you would have a pair."
			}, {
				"joke": "Lady: How do I spread love in this cruel world?",
				"punchline": "Random Dude: [...????]"
			}, {
				"joke": "A user interface is like a joke.",
				"punchline": "If you have to explain it then it is not that good."
			}, {
				"type": "knock-knock",
				"joke": "Knock knock. \n Who's there? \n Hatch. \n Hatch who?",
				"punchline": "Bless you!"
			}, {
				"joke": "What do you call sad coffee?",
				"punchline": "Despresso."
			}, {
				"joke": "Why did the butcher work extra hours at the shop?",
				"punchline": "To make ends meat."
			}, {
				"joke": "Did you hear about the hungry clock?",
				"punchline": "It went back four seconds."
			}, {
				"joke": "Well...",
				"punchline": "That's a deep subject."
			}, {
				"joke": "Did You Hear The Story About The Cheese That Saved The World?",
				"punchline": "It was legend dairy."
			}, {
				"joke": "Did You Watch The New Comic Book Movie?",
				"punchline": "It was very graphic!"
			}, {
				"joke": "I Started A New Business Making Yachts In My Attic This Year...",
				"punchline": "The sails are going through the roof."
			}, {
				"joke": "I Got Hit In the Head By A Soda Can, But It Didn't Hurt That Much...",
				"punchline": "It was a soft drink."
			}, {
				"joke": "I Can't Tell If I Like This Blender...",
				"punchline": "It keeps giving me mixed results."
			}, {
				"joke": "WI Couldn't Get A Reservation At The Library...",
				"punchline": "They were fully booked."
			}, {
				"joke": "I was gonna tell you a joke about UDP...",
				"punchline": "...but you might not get it."
			}, {
				"joke": "The punchline often arrives before the set-up.",
				"punchline": "Do you know the problem with UDP jokes?"
			}, {
				"joke": "Why do C# and Java developers keep breaking their keyboards?",
				"punchline": "Because they use a strongly typed language."
			}, {
				"joke": "What do you give to a lemon in need?",
				"punchline": "Lemonaid."
			}, {
				"joke": "Never take advice from electrons.",
				"punchline": "They are always negative."
			}, {
				"joke": "Hey, dad, did you get a haircut?",
				"punchline": "No, I got them all cut."
			}, {
				"joke": "What time is it?",
				"punchline": "I don't know... it keeps changing."
			}, {
				"joke": "A weasel walks into a bar. The bartender says, \"Wow, I've never served a weasel before. What can I get for you?\"",
				"punchline": "Pop,goes the weasel."
			}, {
				"joke": "Bad at golf?",
				"punchline": "Join the club."
			}, {
				"joke": "Can a kangaroo jump higher than the Empire State Building?",
				"punchline": "Of course. The Empire State Building can't jump."
			}, {
				"joke": "Can February march?",
				"punchline": "No, but April may."
			}, {
				"joke": "Can I watch the TV?",
				"punchline": "Yes, but don't turn it on."
			}, {
				"joke": "Dad, can you put my shoes on?",
				"punchline": "I don't think they'll fit me."
			}, {
				"joke": "Did you hear about the bread factory burning down?",
				"punchline": "They say the business is toast."
			}, {
				"joke": "Did you hear about the chameleon who couldn't change color?",
				"punchline": "They had a reptile dysfunction."
			}, {
				"joke": "Did you hear about the cheese factory that exploded in France?",
				"punchline": "There was nothing left but de Brie."
			}, {
				"joke": "Did you hear about the cow who jumped over the barbed wire fence?",
				"punchline": "It was udder destruction."
			}, {
				"joke": "Did you hear about the guy who invented Lifesavers?",
				"punchline": "They say he made a mint."
			}, {
				"joke": "Did you hear about the guy whose whole left side was cut off?",
				"punchline": "He's all right now."
			}, {
				"joke": "Did you hear about the kidnapping at school?",
				"punchline": "It's ok, he woke up."
			}, {
				"joke": "Did you hear about the Mexican train killer?",
				"punchline": "He had loco motives"
			}, {
				"joke": "Did you hear about the new restaurant on the moon?",
				"punchline": "The food is great, but there's just no atmosphere."
			}, {
				"joke": "Did you hear about the runner who was criticized?",
				"punchline": "He just took it in stride"
			}, {
				"joke": "Did you hear about the scientist who was lab partners with a pot of boiling water?",
				"punchline": "He had a very esteemed colleague."
			}, {
				"joke": "Did you hear about the submarine industry?",
				"punchline": "It really took a dive..."
			}, {
				"joke": "Did you hear that David lost his ID in prague?",
				"punchline": "Now we just have to call him Dav."
			}, {
				"joke": "Did you hear that the police have a warrant out on a midget psychic ripping people off?",
				"punchline": "It reads \"Small medium at large.\""
			}, {
				"joke": "Did you hear the joke about the wandering nun?",
				"punchline": "She was a roman catholic."
			}, {
				"joke": "Did you hear the news?",
				"punchline": "FedEx and UPS are merging. They're going to go by the name Fed-Up from now on."
			}, {
				"joke": "Did you hear the one about the guy with the broken hearing aid?",
				"punchline": "Neither did he."
			}, {
				"joke": "Did you know crocodiles could grow up to 15 feet?",
				"punchline": "But most just have 4."
			}, {
				"joke": "What do ghosts call their true love?",
				"punchline": "Their ghoul-friend"
			}, {
				"joke": "Did you know that protons have mass?",
				"punchline": "I didn't even know they were catholic."
			}, {
				"joke": "Did you know you should always take an extra pair of pants golfing?",
				"punchline": "Just in case you get a hole in one."
			}, {
				"joke": "Do I enjoy making courthouse puns?",
				"punchline": "Guilty"
			}, {
				"joke": "Do you know where you can get chicken broth in bulk?",
				"punchline": "The stock market."
			}, {
				"joke": "Do you want a brief explanation of what an acorn is?",
				"punchline": "In a nutshell, it's an oak tree."
			}, {
				"joke": "Ever wondered why bees hum?",
				"punchline": "It's because they don't know the words."
			}, {
				"joke": "Have you ever heard of a music group called Cellophane?",
				"punchline": "They mostly wrap."
			}, {
				"joke": "Have you heard of the band 1023MB?",
				"punchline": "They haven't got a gig yet."
			}, {
				"joke": "Have you heard the rumor going around about butter?",
				"punchline": "Never mind, I shouldn't spread it."
			}, {
				"joke": "How are false teeth like stars?",
				"punchline": "They come out at night!"
			}, {
				"joke": "How can you tell a vampire has a cold?",
				"punchline": "They start coffin."
			}, {
				"joke": "How come a man driving a train got struck by lightning?",
				"punchline": "He was a good conductor."
			}, {
				"joke": "How come the stadium got hot after the game?",
				"punchline": "Because all of the fans left."
			}, {
				"joke": "How did Darth Vader know what Luke was getting for Christmas?",
				"punchline": "He felt his presents."
			}, {
				"joke": "How did the hipster burn the roof of his mouth?",
				"punchline": "He ate the pizza before it was cool."
			}, {
				"joke": "How do hens stay fit?",
				"punchline": "They always egg-cercise!"
			}, {
				"joke": "How do locomotives know where they're going?",
				"punchline": "Lots of training"
			}, {
				"joke": "How do the trees get on the internet?",
				"punchline": "They log on."
			}, {
				"joke": "How do you find Will Smith in the snow?",
				"punchline": " Look for fresh prints."
			}, {
				"joke": "How do you fix a broken pizza?",
				"punchline": "With tomato paste."
			}, {
				"joke": "How do you fix a damaged jack-o-lantern?",
				"punchline": "You use a pumpkin patch."
			}, {
				"joke": "How do you get a baby alien to sleep?",
				"punchline": " You rocket."
			}, {
				"joke": "How do you get two whales in a car?",
				"punchline": "Start in England and drive West."
			}, {
				"joke": "How do you know if there's an elephant under your bed?",
				"punchline": "Your head hits the ceiling!"
			}, {
				"joke": "How do you make a hankie dance?",
				"punchline": "Put a little boogie in it."
			}, {
				"joke": "How do you make holy water?",
				"punchline": "You boil the hell out of it."
			}, {
				"joke": "How do you organize a space party?",
				"punchline": "You planet."
			}, {
				"joke": "How do you steal a coat?",
				"punchline": "You jacket."
			}, {
				"joke": "How do you tell the difference between a crocodile and an alligator?",
				"punchline": "You will see one later and one in a while."
			}, {
				"joke": "How does a dyslexic poet write?",
				"punchline": "Inverse."
			}, {
				"joke": "How does a French skeleton say hello?",
				"punchline": "Bone-jour."
			}, {
				"joke": "How does a penguin build it's house?",
				"punchline": "Igloos it together."
			}, {
				"joke": "How does a scientist freshen their breath?",
				"punchline": "With experi-mints!"
			}, {
				"joke": "How does the moon cut his hair?",
				"punchline": "Eclipse it."
			}, {
				"joke": "How many apples grow on a tree?",
				"punchline": "All of them!"
			}, {
				"joke": "How many bones are in the human hand?",
				"punchline": "A handful of them."
			}, {
				"joke": "How many hipsters does it take to change a lightbulb?",
				"punchline": "Oh, it's a really obscure number. You've probably never heard of it."
			}, {
				"joke": "How many kids with ADD does it take to change a lightbulb?",
				"punchline": "Let's go ride bikes!"
			}, {
				"joke": "How many optometrists does it take to change a light bulb?",
				"punchline": "1 or 2? 1... or 2?"
			}, {
				"joke": "How many seconds are in a year?",
				"punchline": "12. January 2nd, February 2nd, March 2nd, April 2nd.... etc"
			}, {
				"joke": "How many South Americans does it take to change a lightbulb?",
				"punchline": "A Brazilian"
			}, {
				"joke": "How many tickles does it take to tickle an octopus?",
				"punchline": "Ten-tickles!"
			}, {
				"joke": "How much does a hipster weigh?",
				"punchline": "An instagram."
			}, {
				"joke": "How was the snow globe feeling after the storm?",
				"punchline": "A little shaken."
			}, {
				"joke": "Is the pool safe for diving?",
				"punchline": "It deep ends."
			}, {
				"joke": "Is there a hole in your shoe?",
				"punchline": "Noโ€ฆ Then how'd you get your foot in it?"
			}, {
				"joke": "What did the spaghetti say to the other spaghetti?",
				"punchline": "Pasta la vista, baby!"
			}, {
				"joke": "What's 50 Cent's name in Zimbabwe?",
				"punchline": "200 Dollars."
			}, {
				"joke": "Want to hear a chimney joke?",
				"punchline": "Got stacks of em! First one's on the house"
			}, {
				"joke": "Want to hear a joke about construction?",
				"punchline": "Nah, I'm still working on it."
			}, {
				"joke": "Want to hear my pizza joke?",
				"punchline": "Never mind, it's too cheesy."
			}, {
				"joke": "What animal is always at a game of cricket?",
				"punchline": "A bat."
			}, {
				"joke": "What are the strongest days of the week?",
				"punchline": "Saturday and Sunday...the rest are weekdays."
			}, {
				"joke": "What biscuit does a short person like?",
				"punchline": "Shortbread. "
			}, {
				"joke": "What cheese can never be yours?",
				"punchline": "Nacho cheese."
			}, {
				"joke": "What creature is smarter than a talking parrot?",
				"punchline": "A spelling bee."
			}, {
				"joke": "What did celery say when he broke up with his girlfriend?",
				"punchline": "She wasn't right for me, so I really don't carrot all."
			}, {
				"joke": "What did Michael Jackson name his denim store?",
				"punchline": "Billy Jeans!"
			}, {
				"joke": "What did one nut say as he chased another nut?",
				"punchline": " I'm a cashew!"
			}, {
				"joke": "What did one plate say to the other plate?",
				"punchline": "Dinner is on me!"
			}, {
				"joke": "What did one snowman say to the other snow man?",
				"punchline": "Do you smell carrot?"
			}, {
				"joke": "What did one wall say to the other wall?",
				"punchline": "I'll meet you at the corner!"
			}, {
				"joke": "What did Romans use to cut pizza before the rolling cutter was invented?",
				"punchline": "Lil Caesars"
			}, {
				"joke": "What did the 0 say to the 8?",
				"punchline": "Nice belt."
			}, {
				"joke": "What did the beaver say to the tree?",
				"punchline": "It's been nice gnawing you."
			}, {
				"joke": "What did the big flower say to the littler flower?",
				"punchline": "Hi, bud!"
			}, {
				"joke": "What did the Buffalo say to his little boy when he dropped him off at school?",
				"punchline": "Bison."
			}, {
				"joke": "What did the digital clock say to the grandfather clock?",
				"punchline": "Look, no hands!"
			}, {
				"joke": "What did the dog say to the two trees?",
				"punchline": "Bark bark."
			}, {
				"joke": "What did the Dorito farmer say to the other Dorito farmer?",
				"punchline": "Cool Ranch!"
			}, {
				"joke": "What did the fish say when it swam into a wall?",
				"punchline": "Damn!"
			}, {
				"joke": "What did the grape do when he got stepped on?",
				"punchline": "He let out a little wine."
			}, {
				"joke": "What did the judge say to the dentist?",
				"punchline": "Do you swear to pull the tooth, the whole tooth and nothing but the tooth?"
			}, {
				"joke": "What did the late tomato say to the early tomato?",
				"punchline": "I'll ketch up"
			}, {
				"joke": "What did the left eye say to the right eye?",
				"punchline": "Between us, something smells!"
			}, {
				"joke": "What did the mountain climber name his son?",
				"punchline": "Cliff."
			}, {
				"joke": "What did the ocean say to the beach?",
				"punchline": "Thanks for all the sediment."
			}, {
				"joke": "What did the ocean say to the shore?",
				"punchline": "Nothing, it just waved."
			}, {
				"joke": "Why don't you find hippopotamuses hiding in trees?",
				"punchline": "They're really good at it."
			}, {
				"joke": "What did the pirate say on his 80th birthday?",
				"punchline": "Aye Matey!"
			}, {
				"joke": "What did the Red light say to the Green light?",
				"punchline": "Don't look at me I'm changing!"
			}, {
				"joke": "What did the scarf say to the hat?",
				"punchline": "You go on ahead, I am going to hang around a bit longer."
			}, {
				"joke": "What did the shy pebble wish for?",
				"punchline": "That she was a little boulder."
			}, {
				"joke": "What did the traffic light say to the car as it passed?",
				"punchline": "Don't look I'm changing!"
			}, {
				"joke": "What did the Zen Buddist say to the hotdog vendor?",
				"punchline": "Make me one with everything."
			}, {
				"joke": "What do birds give out on Halloween?",
				"punchline": "Tweets."
			}, {
				"joke": "What do I look like?",
				"punchline": "A JOKE MACHINE!?"
			}, {
				"joke": "What do prisoners use to call each other?",
				"punchline": "Cell phones."
			}, {
				"joke": "What do vegetarian zombies eat?",
				"punchline": "Grrrrrainnnnnssss."
			}, {
				"joke": "What do you call a bear with no teeth?",
				"punchline": "A gummy bear!"
			}, {
				"joke": "What do you call a bee that lives in America?",
				"punchline": "A USB."
			}, {
				"joke": "What do you call a boomerang that won't come back?",
				"punchline": "A stick."
			}, {
				"joke": "What do you call a careful wolf?",
				"punchline": "Aware wolf."
			}, {
				"joke": "What do you call a cow on a trampoline?",
				"punchline": "A milk shake!"
			}, {
				"joke": "What do you call a cow with no legs?",
				"punchline": "Ground beef."
			}, {
				"joke": "What do you call a cow with two legs?",
				"punchline": "Lean beef."
			}, {
				"joke": "What do you call a crowd of chess players bragging about their wins in a hotel lobby?",
				"punchline": "Chess nuts boasting in an open foyer."
			}, {
				"joke": "What do you call a dad that has fallen through the ice?",
				"punchline": "A Popsicle."
			}, {
				"joke": "What do you call a dictionary on drugs?",
				"punchline": "High definition."
			}, {
				"joke": "what do you call a dog that can do magic tricks?",
				"punchline": "a labracadabrador"
			}, {
				"joke": "What do you call a droid that takes the long way around?",
				"punchline": "R2 detour."
			}, {
				"joke": "What do you call a duck that gets all A's?",
				"punchline": "A wise quacker."
			}, {
				"joke": "What do you call a fake noodle?",
				"punchline": "An impasta."
			}, {
				"joke": "What do you call a fashionable lawn statue with an excellent sense of rhythmn?",
				"punchline": "A metro-gnome"
			}, {
				"joke": "What do you call a fat psychic?",
				"punchline": "A four-chin teller."
			}, {
				"joke": "What do you call a fly without wings?",
				"punchline": "A walk."
			}, {
				"joke": "What do you call a girl between two posts?",
				"punchline": "Annette."
			}, {
				"joke": "What do you call a group of disorganized cats?",
				"punchline": "A cat-tastrophe."
			}, {
				"joke": "What do you call a group of killer whales playing instruments?",
				"punchline": "An Orca-stra."
			}, {
				"joke": "What do you call a monkey in a mine field?",
				"punchline": "A babooooom!"
			}, {
				"joke": "What do you call a nervous javelin thrower?",
				"punchline": "Shakespeare."
			}, {
				"joke": "What do you call a pig that knows karate?",
				"punchline": "A pork chop!"
			}, {
				"joke": "What do you call a pig with three eyes?",
				"punchline": "Piiig"
			}, {
				"joke": "What do you call a pile of cats?",
				"punchline": " A Meowtain."
			}, {
				"joke": "What do you call a sheep with no legs?",
				"punchline": "A cloud."
			}, {
				"joke": "What do you call a troublesome Canadian high schooler?",
				"punchline": "A poutine."
			}, {
				"joke": "What do you call an alligator in a vest?",
				"punchline": "An in-vest-igator!"
			}, {
				"joke": "What do you call an Argentinian with a rubber toe?",
				"punchline": "Roberto"
			}, {
				"joke": "What do you call an eagle who can play the piano?",
				"punchline": "Talonted!"
			}, {
				"joke": "What do you call an elephant that doesn't matter?",
				"punchline": "An irrelephant."
			}, {
				"joke": "What do you call an old snowman?",
				"punchline": "Water."
			}, {
				"joke": "What do you call cheese by itself?",
				"punchline": "Provolone."
			}, {
				"joke": "What do you call corn that joins the army?",
				"punchline": "Kernel."
			}, {
				"joke": "What do you call someone with no nose?",
				"punchline": "Nobody knows."
			}, {
				"joke": "What do you call two barracuda fish?",
				"punchline": " A Pairacuda!"
			}, {
				"joke": "What do you do on a remote island?",
				"punchline": "Try and find the TV island it belongs to."
			}, {
				"joke": "What do you do when you see a space man?",
				"punchline": "Park your car, man."
			}, {
				"joke": "What do you get hanging from Apple trees?",
				"punchline": "Sore arms."
			}, {
				"joke": "What do you get when you cross a bee and a sheep?",
				"punchline": "A bah-humbug."
			}, {
				"joke": "What do you get when you cross a chicken with a skunk?",
				"punchline": "A fowl smell!"
			}, {
				"joke": "What do you get when you cross a rabbit with a water hose?",
				"punchline": "Hare spray."
			}, {
				"joke": "What do you get when you cross a snowman with a vampire?",
				"punchline": "Frostbite."
			}, {
				"joke": "What do you give a sick lemon?",
				"punchline": "Lemonaid."
			}, {
				"joke": "What does a clock do when it's hungry?",
				"punchline": "It goes back four seconds!"
			}, {
				"joke": "What does a female snake use for support?",
				"punchline": "A co-Bra!"
			}, {
				"joke": "What does a pirate pay for his corn?",
				"punchline": "A buccaneer!"
			}, {
				"joke": "What does an angry pepper do?",
				"punchline": "It gets jalapeรฑo face."
			}, {
				"joke": "What happens to a frog's car when it breaks down?",
				"punchline": "It gets toad."
			}, {
				"joke": "What happens when you anger a brain surgeon?",
				"punchline": "They will give you a piece of your mind."
			}, {
				"joke": "What has ears but cannot hear?",
				"punchline": "A field of corn."
			}, {
				"joke": "What is a centipedes's favorite Beatle song?",
				"punchline": " I want to hold your hand, hand, hand, hand..."
			}, {
				"joke": "What is a tornado's favorite game to play?",
				"punchline": "Twister!"
			}, {
				"joke": "What is a vampire's favorite fruit?",
				"punchline": "A blood orange."
			}, {
				"joke": "What is a witch's favorite subject in school?",
				"punchline": "Spelling!"
			}, {
				"joke": "What is red and smells like blue paint?",
				"punchline": "Red paint!"
			}, {
				"joke": "What is the difference between ignorance and apathy?",
				"punchline": "I don't know and I don't care."
			}, {
				"joke": "What is the hardest part about sky diving?",
				"punchline": "The ground."
			}, {
				"joke": "What is the leading cause of dry skin?",
				"punchline": "Towels"
			}, {
				"joke": "What is the least spoken language in the world?",
				"punchline": "Sign Language"
			}, {
				"joke": "What is the tallest building in the world?",
				"punchline": "The library, it's got the most stories!"
			}, {
				"joke": "What is this movie about?",
				"punchline": "It is about 2 hours long."
			}, {
				"joke": "What kind of award did the dentist receive?",
				"punchline": "A little plaque."
			}, {
				"joke": "What kind of bagel can fly?",
				"punchline": "A plain bagel."
			}, {
				"joke": "What kind of dinosaur loves to sleep?",
				"punchline": "A stega-snore-us."
			}, {
				"joke": "What kind of dog lives in a particle accelerator?",
				"punchline": "A Fermilabrador Retriever."
			}, {
				"joke": "What kind of magic do cows believe in?",
				"punchline": "MOODOO."
			}, {
				"joke": "What kind of music do planets listen to?",
				"punchline": "Nep-tunes."
			}, {
				"joke": "What kind of pants do ghosts wear?",
				"punchline": "Boo jeans."
			}, {
				"joke": "What kind of tree fits in your hand?",
				"punchline": "A palm tree!"
			}, {
				"joke": "What lies at the bottom of the ocean and twitches?",
				"punchline": "A nervous wreck."
			}, {
				"joke": "What musical instrument is found in the bathroom?",
				"punchline": "A tuba toothpaste."
			}, {
				"joke": "What time did the man go to the dentist?",
				"punchline": "Tooth hurt-y."
			}, {
				"joke": "What type of music do balloons hate?",
				"punchline": "Pop music!"
			}, {
				"joke": "What was a more important invention than the first telephone?",
				"punchline": "The second one."
			}, {
				"joke": "What was the pumpkin's favorite sport?",
				"punchline": "Squash."
			}, {
				"joke": "What's black and white and read all over?",
				"punchline": "The newspaper."
			}, {
				"joke": "What's blue and not very heavy?",
				"punchline": " Light blue."
			}, {
				"joke": "What's brown and sticky?",
				"punchline": "A stick."
			}, {
				"joke": "What's orange and sounds like a parrot?",
				"punchline": "A Carrot."
			}, {
				"joke": "What's red and bad for your teeth?",
				"punchline": "A Brick."
			}, {
				"joke": "What's the best thing about elevator jokes?",
				"punchline": "They work on so many levels."
			}, {
				"joke": "What's the difference between a guitar and a fish?",
				"punchline": "You can tune a guitar but you can't \"tuna\"fish!"
			}, {
				"joke": "What's the difference between a hippo and a zippo?",
				"punchline": "One is really heavy, the other is a little lighter."
			}, {
				"joke": "What's the difference between a seal and a sea lion?",
				"punchline": "An ion! "
			}, {
				"joke": "What's the worst part about being a cross-eyed teacher?",
				"punchline": "They can't control their pupils."
			}, {
				"joke": "What's the worst thing about ancient history class?",
				"punchline": "The teachers tend to Babylon."
			}, {
				"joke": "What's brown and sounds like a bell?",
				"punchline": "Dung!"
			}, {
				"joke": "What's E.T. short for?",
				"punchline": "He's only got little legs."
			}, {
				"joke": "What's Forest Gump's Facebook password?",
				"punchline": "1forest1"
			}, {
				"joke": "What's the advantage of living in Switzerland?",
				"punchline": "Well, the flag is a big plus."
			}, {
				"joke": "What's the difference between an African elephant and an Indian elephant?",
				"punchline": "About 5000 miles."
			}, {
				"joke": "When do doctors get angry?",
				"punchline": "When they run out of patients."
			}, {
				"joke": "When does a joke become a dad joke?",
				"punchline": "When it becomes apparent."
			}, {
				"joke": "When is a door not a door?",
				"punchline": "When it's ajar."
			}, {
				"joke": "Where did you learn to make ice cream?",
				"punchline": "Sunday school."
			}, {
				"joke": "Where do bees go to the bathroom?",
				"punchline": " The BP station."
			}, {
				"joke": "Where do hamburgers go to dance?",
				"punchline": "The meat-ball."
			}, {
				"joke": "Where do rabbits go after they get married?",
				"punchline": "On a bunny-moon."
			}, {
				"joke": "Where do sheep go to get their hair cut?",
				"punchline": "The baa-baa shop."
			}, {
				"joke": "Where do you learn to make banana splits?",
				"punchline": "At sundae school."
			}, {
				"joke": "Where do young cows eat lunch?",
				"punchline": "In the calf-ateria."
			}, {
				"joke": "Where does batman go to the bathroom?",
				"punchline": "The batroom."
			}, {
				"joke": "Where does Fonzie like to go for lunch?",
				"punchline": "Chick-Fil-Eyyyyyyyy."
			}, {
				"joke": "Where does Napoleon keep his armies?",
				"punchline": "In his sleevies."
			}, {
				"joke": "Where was the Declaration of Independence signed?",
				"punchline": "At the bottom! "
			}, {
				"joke": "Where's the bin?",
				"punchline": "I haven't been anywhere!"
			}, {
				"joke": "Which side of the chicken has more feathers?",
				"punchline": "The outside."
			}, {
				"joke": "Who did the wizard marry?",
				"punchline": "His ghoul-friend"
			}, {
				"joke": "Who is the coolest Doctor in the hospital?",
				"punchline": "The hip Doctor!"
			}, {
				"joke": "Why are fish easy to weigh?",
				"punchline": "Because they have their own scales."
			}, {
				"joke": "Why are fish so smart?",
				"punchline": "Because they live in schools!"
			}, {
				"joke": "Why are ghosts bad liars?",
				"punchline": "Because you can see right through them!"
			}, {
				"joke": "Why are graveyards so noisy?",
				"punchline": "Because of all the coffin."
			}, {
				"joke": "Why are mummys scared of vacation?",
				"punchline": "They're afraid to unwind."
			}, {
				"joke": "Why are oranges the smartest fruit?",
				"punchline": "Because they are made to concentrate. "
			}, {
				"joke": "Why are pirates called pirates?",
				"punchline": "Because they arrr!"
			}, {
				"joke": "Why are skeletons so calm?",
				"punchline": "Because nothing gets under their skin."
			}, {
				"joke": "Why can't a bicycle stand on its own?",
				"punchline": "It's two-tired."
			}, {
				"joke": "Why can't you use \"Beef stew\"as a password?",
				"punchline": "Because it's not stroganoff."
			}, {
				"joke": "Why can't your nose be 12 inches long?",
				"punchline": "Because then it'd be a foot!"
			}, {
				"joke": "Why can't you hear a pterodactyl go to the bathroom?",
				"punchline": "The p is silent."
			}, {
				"joke": "Why couldn't the kid see the pirate movie?",
				"punchline": "Because it was rated arrr!"
			}, {
				"joke": "Why couldn't the lifeguard save the hippie?",
				"punchline": "He was too far out, man."
			}, {
				"joke": "Why did Dracula lie in the wrong coffin?",
				"punchline": "He made a grave mistake."
			}, {
				"joke": "Why did Sweden start painting barcodes on the sides of their battleships?",
				"punchline": "So they could Scandinavian."
			}, {
				"joke": "Why did the A go to the bathroom and come out as an E?",
				"punchline": "Because he had a vowel movement."
			}, {
				"joke": "Why did the barber win the race?",
				"punchline": "He took a short cut."
			}, {
				"joke": "Why did the belt go to prison?",
				"punchline": "He held up a pair of pants!"
			}, {
				"joke": "Why did the burglar hang his mugshot on the wall?",
				"punchline": "To prove that he was framed!"
			}, {
				"joke": "Why did the chicken get a penalty?",
				"punchline": "For fowl play."
			}, {
				"joke": "Why did the Clydesdale give the pony a glass of water?",
				"punchline": "Because he was a little horse!"
			}, {
				"joke": "Why did the coffee file a police report?",
				"punchline": "It got mugged."
			}, {
				"joke": "Why did the cookie cry?",
				"punchline": "Because his mother was a wafer so long"
			}, {
				"joke": "Why did the cookie cry?",
				"punchline": "It was feeling crumby."
			}, {
				"joke": "Why did the cowboy have a weiner dog?",
				"punchline": "Somebody told him to get a long little doggy."
			}, {
				"joke": "Why did the fireman wear red, white, and blue suspenders?",
				"punchline": "To hold his pants up."
			}, {
				"joke": "Why did the girl smear peanut butter on the road?",
				"punchline": "To go with the traffic jam."
			}, {
				"joke": "Why did the half blind man fall in the well?",
				"punchline": "Because he couldn't see that well!"
			}, {
				"joke": "Why did the house go to the doctor?",
				"punchline": "It was having window panes."
			}, {
				"joke": "Why did the kid cross the playground?",
				"punchline": "To get to the other slide."
			}, {
				"joke": "Why did the man put his money in the freezer?",
				"punchline": "He wanted cold hard cash!"
			}, {
				"joke": "Why did the man run around his bed?",
				"punchline": "Because he was trying to catch up on his sleep!"
			}, {
				"joke": "Why did the melons plan a big wedding?",
				"punchline": "Because they cantaloupe!"
			}, {
				"joke": "Why did the octopus beat the shark in a fight?",
				"punchline": "Because it was well armed."
			}, {
				"joke": "Why did the opera singer go sailing?",
				"punchline": "They wanted to hit the high Cs."
			}, {
				"joke": "Why did the scarecrow win an award?",
				"punchline": "Because he was outstanding in his field."
			}, {
				"joke": "Why did the tomato blush?",
				"punchline": "Because it saw the salad dressing."
			}, {
				"joke": "Why did the tree go to the dentist?",
				"punchline": "It needed a root canal."
			}, {
				"joke": "Why did the worker get fired from the orange juice factory?",
				"punchline": "Lack of concentration."
			}, {
				"joke": "Why didn't the number 4 get into the nightclub?",
				"punchline": "Because he is 2 square."
			}, {
				"joke": "Why didn't the orange win the race?",
				"punchline": "It ran out of juice."
			}, {
				"joke": "Why didn't the skeleton cross the road?",
				"punchline": "Because he had no guts."
			}, {
				"joke": "Why do bananas have to put on sunscreen before they go to the beach?",
				"punchline": "Because they might peel!"
			}, {
				"joke": "Why do bears have hairy coats?",
				"punchline": "Fur protection."
			}, {
				"joke": "Why do bees have sticky hair?",
				"punchline": "Because they use honey combs!"
			}, {
				"joke": "Why do bees hum?",
				"punchline": "Because they don't know the words."
			}, {
				"joke": "Why do birds fly south for the winter?",
				"punchline": "Because it's too far to walk."
			}, {
				"joke": "Why do choirs keep buckets handy?",
				"punchline": "So they can carry their tune"
			}, {
				"joke": "Why do crabs never give to charity?",
				"punchline": "Because they're shellfish."
			}, {
				"joke": "Why do ducks make great detectives?",
				"punchline": "They always quack the case."
			}, {
				"joke": "Why do mathematicians hate the U.S.?",
				"punchline": "Because it's indivisible."
			}, {
				"joke": "Why do pirates not know the alphabet?",
				"punchline": "They always get stuck at \"C\"."
			}, {
				"joke": "Why do pumpkins sit on people's porches?",
				"punchline": "They have no hands to knock on the door."
			}, {
				"joke": "Why do scuba divers fall backwards into the water?",
				"punchline": "Because if they fell forwards they'd still be in the boat."
			}, {
				"joke": "Why do trees seem suspicious on sunny days?",
				"punchline": "Dunno, they're just a bit shady."
			}, {
				"joke": "Why do valley girls hang out in odd numbered groups?",
				"punchline": "Because they can't even."
			}, {
				"joke": "Why do wizards clean their teeth three times a day?",
				"punchline": "To prevent bat breath!"
			}, {
				"joke": "Why do you never see elephants hiding in trees?",
				"punchline": "Because they're so good at it."
			}, {
				"joke": "Why does a chicken coop only have two doors?",
				"punchline": "Because if it had four doors it would be a chicken sedan."
			}, {
				"joke": "Why does a Moon-rock taste better than an Earth-rock?",
				"punchline": "Because it's a little meteor."
			}, {
				"joke": "Why does it take longer to get from 1st to 2nd base, than it does to get from 2nd to 3rd base?",
				"punchline": "Because there's a Shortstop in between!"
			}, {
				"joke": "Why does Norway have barcodes on their battleships?",
				"punchline": "So when they get back to port, they can Scandinavian."
			}, {
				"joke": "Why does Superman get invited to dinners?",
				"punchline": "Because he is a Supperhero."
			}, {
				"joke": "Why does Waldo only wear stripes?",
				"punchline": "Because he doesn't want to be spotted."
			}, {
				"joke": "Dad, can you put my shoes on?",
				"punchline": " No, I don't think they'll fit me."
			},
			{
				"joke": "Dad, did you get a haircut?",
				"punchline": " No I got them all cut."
			},
			{
				"joke": "Did I tell you the time I fell in love during a backflip?",
				"punchline": " I was heels over head."
			},
			{
				"joke": "Did you hear about the circus fire?",
				"punchline": " It was in tents!"
			},
			{
				"joke": "Did you hear about the fire at the circus?",
				"punchline": " IT WAS IN TENTS."
			},
			{
				"joke": "Did you hear about the guy whose whole left side was cut off?",
				"punchline": " He's all right now."
			},
			{
				"joke": "Did you hear about the Hyena who drank a pint of gravy?",
				"punchline": " He was a laughing stock!"
			},
			{
				"joke": "Did you hear about the kidnapping at school?",
				"punchline": " It's fine, he woke up."
			},
			{
				"joke": "Did you hear about the new restaurant on the moon?",
				"punchline": " The food is great, but there's just no atmosphere."
			},
			{
				"joke": "Did you hear about the red ship and the blue ship that collided?",
				"punchline": " Both crews were marooned."
			},
			{
				"joke": "Did you hear about the restaurant on the moon?",
				"punchline": " Great food, no atmosphere."
			},
			{
				"joke": "Did you hear that the police have a warrant out on a midget psychic ripping people off?",
				"punchline": " It reads 'Small medium at large.'"
			},
			{
				"joke": "Did you know the first French fries weren't actually cooked in France?",
				"punchline": " They were cooked in grease."
			},
			{
				"joke": "Did you see they made round bails of hay illegal in Wisconsin?",
				"punchline": " It's because the cows weren't getting a square meal."
			},
			{
				"joke": "Have you heard the one about the Corduroy pillow?",
				"punchline": " It's making HEADLINES!"
			},
			{
				"joke": "How did Darth Vader know what Luke got him for Christmas?",
				"punchline": " He felt his presents!"
			},
			{
				"joke": "How do you count cows?",
				"punchline": " A 'Cow'culator."
			},
			{
				"joke": "How do you find Will Smith in the snow?",
				"punchline": " You look for the fresh prints."
			},
			{
				"joke": "How do you fix a broken tuba?",
				"punchline": " With a tuba glue!"
			},
			{
				"joke": "How do you make a tissue dance?",
				"punchline": " Put a little boogie in it!"
			},
			{
				"joke": "How do you make toast in the jungle?",
				"punchline": " Pop your bread under a g'rilla."
			},
			{
				"joke": "How do you turn a duck into a soul singer?",
				"punchline": " Put it in a microwave until its bill withers."
			},
			{
				"joke": "How does a burglar get into your house?",
				"punchline": " Intruder window."
			},
			{
				"joke": "How does a lion like his meat?",
				"punchline": " ROAR!"
			},
			{
				"joke": "How does a penguin build it's house?",
				"punchline": " Igloos it together."
			},
			{
				"joke": "How does an octopus go to war?",
				"punchline": " WELL-ARMED!"
			},
			{
				"joke": "How does Hitler tie his shoes?",
				"punchline": " with little Nazis!"
			},
			{
				"joke": "How does the man in the moon cut his hair?",
				"punchline": " ECLIPSE IT!"
			},
			{
				"joke": "How many apples grow on a tree?",
				"punchline": " All of them."
			},
			{
				"joke": "How many tickles does it take to make an octopus laugh?",
				"punchline": " Ten-tickles."
			},
			{
				"joke": "How much does a pirate pay for corn?",
				"punchline": " A buccaneer!"
			},
			{
				"joke": "Want to hear a joke about construction?",
				"punchline": " I'm still working on it."
			},
			{
				"joke": "Want to hear a joke about paper?",
				"punchline": " Nevermind, it's tearable."
			},
			{
				"joke": "What did 0 say to 8?",
				"punchline": " Nice belt!"
			},
			{
				"joke": "what did one hat say to another?",
				"punchline": " You stay here, I'll go on a head!"
			},
			{
				"joke": "What did one shark say to the other while eating a clownfish?",
				"punchline": " This tastes funny."
			},
			{
				"joke": "What did one snowman say to the other?",
				"punchline": " Do you smell carrots?"
			},
			{
				"joke": "What did the baby say to its mother after breastfeeding?",
				"punchline": " Thanks for the mammaries!"
			},
			{
				"joke": "What did the big bucket say to the little bucket?",
				"punchline": " You look a little pail!"
			},
			{
				"joke": "What did the Buddhist say to the hot dog vendor?",
				"punchline": " Make me one with everything!"
			},
			{
				"joke": "What did the buffalo say to his son when he dropped him off at school?",
				"punchline": " Bison."
			},
			{
				"joke": "What did the cobbler say when a cat wandered into his shop?",
				"punchline": " Shoe!"
			},
			{
				"joke": "What did the elder chimney say to the younger chimney?",
				"punchline": " You're too young to smoke!"
			},
			{
				"joke": "What did the fish say when he ran into the wall?",
				"punchline": " Dam."
			},
			{
				"joke": "What did the ghost say to the bee?",
				"punchline": " BOO-BEE!"
			},
			{
				"joke": "What did the grape do when he got stepped on?",
				"punchline": " He let out a little wine."
			},
			{
				"joke": "What did the grape say after the elephant sat on it?",
				"punchline": " Nothing, it just let out a little whine!"
			},
			{
				"joke": "What did the green grape say to the purple grape?",
				"punchline": " Breathe, you fool, breathe!"
			},
			{
				"joke": "What did the monkey say when he caught his tail in the revolving door?",
				"punchline": " It won't be long now."
			},
			{
				"joke": "What did the mother Buffalo say when her boy left for college?",
				"punchline": " BYE-SON!"
			},
			{
				"joke": "What did the pirate say on his 80th birthday?",
				"punchline": " Aye matey."
			},
			{
				"joke": "What did the policeman say to his tummy?",
				"punchline": " I've got you under a vest!"
			},
			{
				"joke": "What did the psychiatrist say when a man wearing nothing but saran wrap walked into his office?",
				"punchline": " I can clearly see you're nuts!"
			},
			{
				"joke": "What did the traffic light say to the car?",
				"punchline": " Don't look, I'm changing."
			},
			{
				"joke": "What did the worker at the rubber band factory say when he lost his job?",
				"punchline": " OH SNAP!"
			},

Fix !breakpoint parser

  • format message as a Slack link <url|text>
  • Rename the file to a more descriptive file name.

Recreate parser for !zalgo

old script:

(function executeRule(current, previous /*null when async*/) {

	var where = 0;
	var which = '';
	if (current.text.indexOf('!zalgo') > -1) {
		where = current.text.indexOf('!zalgo') + 7;
		which = 'zalgo';
	} else if (current.text.indexOf('!curse') > -1){
		where = current.text.indexOf('!curse') + 7;
		which = 'curse';
	} else {
		return;
	}

	var zalgo_mid = [
		'\u0315', /*     ฬ•     */		'\u031b', /*     ฬ›     */		'\u0340', /*     อ€     */		'\u0341', /*     อ     */
		'\u0358', /*     อ˜     */		'\u0321', /*     ฬก     */		'\u0322', /*     ฬข     */		'\u0327', /*     ฬง     */
		'\u0328', /*     ฬจ     */		'\u0334', /*     ฬด     */		'\u0335', /*     ฬต     */		'\u0336', /*     ฬถ     */
		'\u034f', /*     อ     */		'\u035c', /*     อœ     */		'\u035d', /*     อ     */		'\u035e', /*     อž     */
		'\u035f', /*     อŸ     */		'\u0360', /*     อ      */		'\u0362', /*     อข     */		'\u0338', /*     ฬธ     */
		'\u0337', /*     ฬท     */		'\u0361' /*     อก     */	
	];

	// rand funcs
	//---------------------------------------------------

	//gets an int between 0 and max
	function rand(max)
	{
		return Math.floor(Math.random() * max);
	}

	//gets a random char from a zalgo char table
	function rand_zalgo(array)
	{
		var ind = Math.floor(Math.random() * array.length);
		return array[ind];
	}

	//lookup char to know if its a zalgo char or not
	function is_zalgo_char(c)
	{
		var i;
		for(i=0; i<zalgo_mid.length; i++)
			if(c == zalgo_mid[i])
				return true;
		return false;
	}

	// main shit
	//---------------------------------------------------
	function zalgo_textarea(text)
	{
		var return_this = '';
		var txt = text;
		var newtxt = '';

		for(var i=0; i<txt.length; i++)
		{
			if(is_zalgo_char(txt.substr(i, 1)))
				continue;

			//add the normal character
			newtxt += txt.substr(i, 1);

			var num_mid = rand(2);

			for(var j=0; j<num_mid; j++){
				newtxt += rand_zalgo(zalgo_mid);
			}
		}
		return newtxt;
	}

	var term = current.text.substr(where).trim();
	if (term == '') {
		var send_confusion = new SlackFall().send_chat(current.channel, zalgo_textarea('yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. yoU HaVe MIsused tHe ZalGo CompilER and noW i, tHe BeaST of SErvICENoW HaS BeEN SumMoneD TO Do your bIdding. ') + '\njust kidding, you need to include something after !zalgo or !curse for it to work', false, '', current.thread_ts);
		return;
	}
	var end = zalgo_textarea(term);
	// 	gs.info(end);
	var send_flip = new SlackFall().send_chat(current.channel, end, false, '', current.thread_ts);


	function flipString(aString) {
		var last = aString.length - 1;

		var result = new Array(aString.length);
		for (var i = last; i >= 0; --i) {
			var c = aString.charAt(i);
			var r = flipTable[c];
			result[last - i] = r != undefined ? r : c;
		}
		return result.join('');

	}

})(current, previous);

Add examples to readme and contributing to help people understand easy vs hard

Explain that the easy method should be for simple parsers that are "likely to work without testing" like single line call-and-response parsers and include links to existing parsers that fit this

Explain that the hard method is got more complex ones because it will require testing to ensure it works before a pull request is started

Recreate parser for !flip

old script:

(function executeRule(current, previous /*null when async*/) {

	var where = 0;
	var which = '';
	if (current.text.indexOf('!flip') > -1) {
		where = current.text.indexOf('!flip') + 6;
		which = 'flip';
	} else if (current.text.indexOf('!invert') > -1){
		where = current.text.indexOf('!invert') + 8;
		which = 'invert';
	} else {
		return;
	}

	var flipTable = {
		'a' : '\u0250',
		'b' : 'q',
		'c' : '\u0254', //open o -- from pne
		'd' : 'p',
		'e' : '\u01DD',
		'f' : '\u025F', //from pne
		'g' : '\u0183',
		'h' : '\u0265',
		'i' : '\u0131', //from pne
		'j' : '\u027E',
		'k' : '\u029E',
		//l : '\u0283',
		'm' : '\u026F',
		'n' : 'u',
		'p' : 'd',
		'q' : 'b',
		'r' : '\u0279',
		't' : '\u0287',
		'u' : 'n',
		'v' : '\u028C',
		'w' : '\u028D',
		'y' : '\u028E',
		'.' : '\u02D9',
		'[' : ']',
		'(' : ')',
		'{' : '}',
		'?' : '\u00BF', //from pne
		'!' : '\u00A1',
		"\'" : ',',
		'<' : '>',
		'_' : '\u203E',
		';' : '\u061B',
		'\u203F' : '\u2040',
		'\u2045' : '\u2046',
		'\u2234' : '\u2235',
		'\r' : '\n' 
	};

	var term = current.text.substr(where).trim();
	if (term == '') {
		var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: !flip or !invert *something*', false, '', current.thread_ts);
		return;
	}
	var end = flipString(term.toLowerCase());
	// 	gs.info(end);
	var send_flip = new SlackFall().send_chat(current.channel, end, false, '', current.thread_ts);


	function flipString(aString) {
		var last = aString.length - 1;

		var result = new Array(aString.length);
		for (var i = last; i >= 0; --i) {
			var c = aString.charAt(i);
			var r = flipTable[c];
			result[last - i] = r != undefined ? r : c;
		}
		return result.join('');

	}

})(current, previous);

Recreate parser for !docs

old script:

(function executeRule(current, previous /*null when async*/) {

	var where = current.text.indexOf('!docs')+6;
		var term = current.text.substr(where).trim();
		if (term == '') {
			var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: !docs *something*', false, '', current.thread_ts);
			return;
		}
		var send_chat = new SlackFall().send_chat(current.channel, 'https://docs.servicenow.com/search?q=' + escape(term) + '&labels=2', false, '', current.thread_ts);
	


})(current, previous);

Rename parser filenames to be more helpful

the !help command prints this:
!bang @person bang
!clap your sentence Clap back
!docs GlideRecord docs
!help All Commands
!iss International Space Station
!jitsi jitsi
!send !random !hey Admin tool - Send
!Tips Tips for Slack
!trout Helming trout
!whois @EarlDuque Admin tool - Whois
!wiki ServiceNow Search Wikipedia(en)
!xkcd wisdom of the ancients xkcd
30c or 30 degrees celcius C to F Converter
30f or 30f degrees celcius F to C Converter
@Chuck.Tomasi Bowtie when chuck is mentioned
happy pride pride-reaction
parrotwave Parrot Wave chat trigger

the format is:
activation_example filename
Note: filename without the .js

Rename all filenames (and if needed, fix their activation examples) to have a better description for the !help command

for example:
rename xkcd.js to Find a relevant XKCD comic.js

Recreate admin parser for !send

old script:

(function executeRule(current, previous /*null when async*/) {

	var regex = /!send !.+!.+/gi;
	if (regex.test(current.text)) {
		var parsing = current.text.split('!');
		var channel = parsing[2].trim();
		var build_message = parsing;
		build_message.shift();
		build_message.shift();
		build_message.shift();
		var message = build_message.join('!');
		var send_chat = new SlackFall().send_chat(channel, message,false);
	}

})(current, previous);

Recreate parser for !roll

old script:

(function executeRule(current, previous /*null when async*/) {

	var sentence = current.text.substr(5).trim();
	if (sentence == '') {
		var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: Say `number` `d` `number`!', false, '', current.thread_ts);
		return;
	}
	var numbers = sentence.split('d');
	for(var k=0; k<numbers.length; k++) { numbers[k] = parseInt(numbers[k], 10); } 
// 	var what = new SlackFall().send_chat(current.channel, isNaN(numbers[0]) + ' ' + isNaN(numbers[1]),false); return;
	if (isNaN(numbers[0]) || isNaN(numbers[1])) {
		var send_more_confusion = new SlackFall().send_chat(current.channel, 'One of those is not a number!', false, '', current.thread_ts);
		return;
	}
	if (numbers[0]>100 || numbers[1]>1000000){
		var send_ridiculous = new SlackFall().send_chat(current.channel, 'You rolled: a lot', false, '', current.thread_ts);
		return;
	}
	if (numbers[0]<1 || numbers[1]<1){
		var send_err = new SlackFall().send_chat(current.channel, 'Stop that', false, '', current.thread_ts);
		return;
	}
	var total_dice = numbers[0];
	var sides = numbers[1];
	var message = 'You rolled: ';
	var current_roll = 0;
	var all_rolls = [];
	for (var i = 1; i <= total_dice; i++){
		current_roll = Math.floor(Math.random() * sides) + 1;
		all_rolls.push(current_roll);
	}
	var sum = 0;
	for( var j = 0; j < all_rolls.length; j++ ){
		sum += parseInt( all_rolls[j], 10 ); //don't forget to add the base
	}

	var avg = sum/all_rolls.length;
	message += all_rolls.join(', ')+'. `Average of ' + avg + '` `Sum of ' + sum + '`';

	var send_lmgtfy = new SlackFall().send_chat(current.channel, message, false, '', current.thread_ts);

})(current, previous);

Recreate parser for !help

old script:

(function executeRule(current, previous /*null when async*/) {
	var message = [
		'`!bang @person` Supportive text for an overworked employee.',
		'`!clap some sentence` Caps lock and clap backs.',
		'`!docs string` Searchs the ServiceNow docs for the string provided.',
		'`!emoji string` translate a message to emojis',
		'`!flip string` Or !invert, flips the string upside down.',
		'`!giphy string` Regular old giphy search but works in threads.',
		'`!google string` Provides a link to a google search for the provided string.',
		'`!insult` *Deactivated and moved to SlackBot instead*. Says an SN-related insult.',
		//'`!iss` Let\'s you know where the International Space Station is right now.',
		'`!job` Creates a random LinkedIn message that an SN Dev is likely to receive from a recruiter.',
		'`!joke` Tells you a joke, obvi.',
		'`!lmgtfy string` A more sassy version of !google.',
		'`!madlib` Provides instructions on how to create a SN-related madlib.',
		'`!parrot wave` Adds excitement to your message.',
		'`!report string` Reports on how often the provided string has appeared in the last 7 days on this workspace.',
		'`!roll 3d6` Rolls three six-sided dice (or any other combination you give).',
		'`!test` Creates a randomly generated SN-related testing script.',
		'`!tips` A summary of tips from the SN Devs pro-tips website',
		'`!trout @person` or `!slap @person` IRC-like slap to whoever you @.',
		//'`!youtube string` Links the first found video on youtube according to your search string',
		'`!zalgo string` or !curse will eff yo text up',
		'`Say 30F or 30C` and it will convert the temperature to the other unit',
		'`!help` ยฏ\\_(ใƒ„)_/ยฏ'
	];
	if (current.channel == 'G9LAJG7G8' || current.channel == 'GD51HTR46') {
		message.push('');
		message.push('The following are #poof only commands:');
		message.push('`!whois @username` Gathers slack information on the user');
		message.push('`!send !channel !message` forces this bot to send that message to that channel');
		message.push('`!ajb` all the ajb spam lol');
	}

	var send_chat = new SlackFall().send_chat(current.channel, message.join('\n'), false, '', current.ts);
})(current, previous);

Recreate parse for !usage

old script:

(function executeRule(current, previous /*null when async*/) {

	var regex = /^\!(?:usage|report)/gmi;
	//var regex2 = /^\!report /gmi;
	if (regex.test(current.text)){
		var report_on = current.text.substr(7).trim();
		if (report_on == '') {
			var send_confusion = new SlackFall().send_chat(current.channel, ':upside_down_face: !usage *something*', false, '', current.thread_ts);
			return;
		}
		var gr = new GlideRecord('x_165574_slackoff_slacker_text_tracker');
		gr.addEncodedQuery('textLIKE'+report_on+'^sys_created_onONLast 7 days@javascript:gs.beginningOfLast7Days()@javascript:gs.endOfLast7Days()');
		gr.query();
		var send_chat = new SlackFall().send_chat(current.channel, 'The message `' + report_on + '` has appeared ' + gr.getRowCount() + ' times in the channels I\'ve been watching in the last seven days.', false, '', current.thread_ts);
	}


})(current, previous);

Recreate parser for !xkcd

old script:

(function executeRule(current, previous /*null when async*/) {

	var search = gs.urlEncode(current.text.replace(/!xkcd/,'').trim());

	var rm = new sn_ws.RESTMessageV2();
	rm.setHttpMethod('GET');
	rm.setEndpoint('https://www.explainxkcd.com/wiki/index.php?search=' + search + '&title=Special%3ASearch&go=Go');
	rm.setRequestHeader('User-Agent', 'servicenow');
	var response = rm.execute();
	var body = response.getBody();
	var result = body.match(/(?:<a href="\/wiki\/index.php\/)[0-9]+/gm)[0].replace(/<a href="\/wiki\/index.php\//g,''); 
	
	
	if (parseInt(result)){
		
		var rm2 = new sn_ws.RESTMessageV2();
		rm2.setHttpMethod('GET');
		rm2.setEndpoint('https://xkcd.com/' + result + '/info.0.json');
		rm2.setRequestHeader('User-Agent', 'servicenow');
		var response2 = rm2.execute();
		var body2 = JSON.parse(response2.getBody());
		var send_chat = new SlackFall().send_chat(current.channel, body2.safe_title + '\n' + body2.img + '\nAlt: ' + body2.alt, false, '', current.thread_ts);
	} else {
		var send_chat2 = new SlackFall().send_chat(current.channel, 'No relevant XKCD found for `' + search +'`', false, '', current.thread_ts);
	}

})(current, previous);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.