Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
mkdir -p pythonsimo-data && touch pythonsimo-data/placeholder

- name: Build images
run: docker compose build ircdjs sandbox simojs
run: docker compose build ircdjs sandbox simojs pythonsimo

integration-tests:
name: IRC integration tests
Expand Down Expand Up @@ -60,7 +60,7 @@ jobs:
mkdir -p pythonsimo-data && touch pythonsimo-data/placeholder

- name: Start services
run: docker compose up --build -d ircdjs sandbox simojs
run: docker compose up --build -d ircdjs sandbox simojs pythonsimo

- name: Wait for bot to connect
run: |
Expand All @@ -75,7 +75,7 @@ jobs:

- name: Show service logs on failure
if: failure()
run: docker compose logs simojs sandbox ircdjs
run: docker compose logs simojs sandbox ircdjs pythonsimo

- name: Stop services
if: always()
Expand Down
11 changes: 10 additions & 1 deletion features/sandcastle.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,23 @@ const printMacro = (client, channel, from, line) =>
const listMacros = (client, channel, from, line) =>
client.say(channel, Object.keys(macros).join(' '));

const findMacro = (client, channel, from, line) => {
const terms = line.split(' ').slice(1);
const matches = Object.keys(macros).filter(name =>
terms.every(word => name.match(new RegExp(word, 'i')))
);
client.say(channel, matches.join(', '));
};

module.exports = {
name: 'eval in a sandbox',
commands: {
'!run': run,
'!addmacro': newMacro,
'!delmacro': delMacro,
'!printmacro': printMacro,
'!listmacros': listMacros
'!listmacros': listMacros,
'!findmacro': findMacro
},
init: init
}
4 changes: 0 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,3 @@ client.connect(function() {
new TimerPoller(client, 30);
});

// Start twitter stream on connect
setTimeout(
() => commands['!twitter'][0](client, config.channels[0], "startup", ""),
3000);
15 changes: 12 additions & 3 deletions test/cases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,26 @@
{ "cmd": "!run exit(moment().format('YYYY'))", "expect": "20\\d\\d", "desc": "moment global in sandbox" },

{ "cmd": "!addmacro +citest exit(arg * 2)", "expect": "added macro", "desc": "add + macro (takes arg)" },
{ "cmd": "!run +citest 21", "expect": "^42$", "desc": "+ macro uses arg" },
{ "cmd": "!+citest 21", "expect": "^42$", "desc": "+ macro uses arg" },

{ "cmd": "!addmacro _ciprinter exit(21)", "expect": "added macro", "desc": "add _ macro (prints)" },
{ "cmd": "!run _ciprinter", "expect": "^21$", "desc": "_ macro prints" },
{ "cmd": "!_ciprinter", "expect": "^21$", "desc": "_ macro prints" },

{ "cmd": "!addmacro *cichain +citest _ciprinter", "expect": "added macro", "desc": "add * hypermacro" },
{ "cmd": "!*cichain", "expect": "^42$", "desc": "* chains _ output as + arg" },

{ "cmd": "!findmacro citest", "expect": "\\+citest", "desc": "findmacro returns matching macro" },

{ "cmd": "!delmacro +citest", "expect": "removed", "desc": "cleanup + macro" },
{ "cmd": "!delmacro _ciprinter", "expect": "removed", "desc": "cleanup _ macro" },
{ "cmd": "!delmacro *cichain", "expect": "removed", "desc": "cleanup * macro" },

{ "cmd": "!cpu", "expect": "memory", "desc": "built-in feature" }
{ "cmd": "!cpu", "expect": "memory", "desc": "built-in feature" },

{ "cmd": "!c 5*5", "expect": "^25$", "desc": "pythonsimo calculator" },
{ "cmd": "!r hello", "expect": "^olleh$", "desc": "pythonsimo string reverse" },

{ "cmd": "!add ciexpl this is a ci expl", "expect": "ciexpl", "desc": "pythonsimo expl add" },
{ "cmd": "!expl ciexpl", "expect": "ci expl", "desc": "pythonsimo expl lookup" },
{ "cmd": "!remove ciexpl 1", "expect": "Deleted", "desc": "pythonsimo expl remove" }
]
Loading