From a245d385f7a3071b240130164462a5dec8bd6ddf Mon Sep 17 00:00:00 2001 From: powerjungle Date: Sun, 28 Feb 2021 13:51:47 +0100 Subject: [PATCH 1/2] Add README.md to tell module --- modules/tell/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 modules/tell/README.md diff --git a/modules/tell/README.md b/modules/tell/README.md new file mode 100644 index 0000000..92ac565 --- /dev/null +++ b/modules/tell/README.md @@ -0,0 +1,11 @@ +## Tell + +### Description +This module leaves a message for somebody in a channel. +If you PM the bot it won't be able to relay your message since it will look for a channel. + +### Command + +#### ~tell [username] [text] +Tell a user something as soon as they come online. + From 97ebd371bf3bc1f141db234827840d95b45460ca Mon Sep 17 00:00:00 2001 From: powerjungle Date: Sun, 28 Feb 2021 20:38:08 +0100 Subject: [PATCH 2/2] Add new clear tells command --- modules/tell/README.md | 4 +++- modules/tell/tell.js | 20 +++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/modules/tell/README.md b/modules/tell/README.md index 92ac565..f54a39e 100644 --- a/modules/tell/README.md +++ b/modules/tell/README.md @@ -4,8 +4,10 @@ This module leaves a message for somebody in a channel. If you PM the bot it won't be able to relay your message since it will look for a channel. -### Command +### Commands #### ~tell [username] [text] Tell a user something as soon as they come online. +#### ~ctells +Clear all tells from your username. diff --git a/modules/tell/tell.js b/modules/tell/tell.js index 422ac8d..7a03928 100644 --- a/modules/tell/tell.js +++ b/modules/tell/tell.js @@ -39,7 +39,25 @@ var tell = function(dbot) { event.reply('no idea who that is mate'); } }); - } + }, + 'ctells': function(event) { // from mokay: i disgust me too + //console.log(tells); + var found_tells = false; + for(var attr in tells){ + for (var attr2 in tells[attr]){ + if (tells[attr][attr2]["from"] == event.user){ + found_tells = true; + tells[attr].splice(attr2, 1); + //console.log(tells); + } + } + } + if (found_tells == false){ + event.reply(event.user + ": no tells found for your username"); + } else if (found_tells == true){ + event.reply(event.user + ": all tells removed from your username"); + } + } } this.commands.tell.regex = [/tell ([^ ]+) (.+)/, 3];