Skip to content

Instantly share code, notes, and snippets.

@copygirl
Last active April 22, 2016 12:41
Show Gist options
  • Save copygirl/6b3fd4844b447fd71c6abab229fd5f41 to your computer and use it in GitHub Desktop.
Save copygirl/6b3fd4844b447fd71c6abab229fd5f41 to your computer and use it in GitHub Desktop.
"use strict";
let { Action } = require("../sockets/Socket");
module.exports = {
testSimple: "Simple text response.",
testRandom: [
"Random text response: Butterflies! (1 / 4)",
"Random text response: Bodypillows! (2 / 4)",
"Random text response: World peace! (3 / 4)",
"Random text response: asie x copy! (4 / 4)"
],
testFunction: () => `Function: ${ Math.floor(Math.random() * 1000) }`,
testEcho: (content) => `Echo: ${ content }`,
testSender: (sender) => `Your name is ${ sender.name.length } characters long.`,
testParts: (message) => [ Action, "was poked by in ", message.target, "." ],
testParameters: (a, b, c) => `Parameter response: '${ a }', '${ b }' and '${ c }'`,
testTypes: (a = Number, b = Socket.User) => `${ a } is a number and ${ b } is a User. Hi!`,
testArgs: (...args) => `Varargs response: ${ args.length } element${ (args.length != 1) ? "s" : "" }. ` +
`Random: ${ args[Math.floor(Math.random() * args.length)] }`,
testConfig: (config) => JSON.stringify(config),
testAll: (message, sender, a, b = Socket.Channel, ...args) => {
message.target.send(`In ${ message.target }, ${ sender } said ${ a } `
`and ${ b } and also ${ args.join(", ") }.`); },
[/regex/]: "You said something about regex?",
[/^(\d+) \+ (\d+) =$/]: (match, a = Number, b = Number) => `${ match } ${ a + b }`,
[/match/g]: (...matches) => `There ${ (matches.length != 1) ? "were" : "was" } ` +
`${ matches.length } match${ (matches.length != 1) ? "es" : "" }`,
[/1d20/]: () => Math.floor(Math.random() * 20)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment