From c33cd58f4ef809ada9df1570ea6aaba227ed8ff4 Mon Sep 17 00:00:00 2001 From: iou1name Date: Wed, 8 Jan 2020 07:18:23 -0500 Subject: [PATCH] remove some old modules --- README.md | 9 +------ modules/countdown.py | 32 ----------------------- modules/iot.py | 60 ------------------------------------------- modules/lmgtfy.py | 12 --------- modules/minecraft.py | 23 ----------------- modules/spellcheck.py | 32 ----------------------- modules/version.py | 10 -------- 7 files changed, 1 insertion(+), 177 deletions(-) delete mode 100755 modules/countdown.py delete mode 100755 modules/iot.py delete mode 100755 modules/lmgtfy.py delete mode 100755 modules/minecraft.py delete mode 100755 modules/spellcheck.py delete mode 100755 modules/version.py diff --git a/README.md b/README.md index de0f0f3..9f3b47b 100755 --- a/README.md +++ b/README.md @@ -3,11 +3,4 @@ It's like Sopel, except rewritten from scratch using Twisted as a base and over ## Requirements Python 3.6+ -System packages: `enchant` -Python packages: `twisted python-dateutil requests bs4 wolframalpha pyenchant emoji pillow ipython numpy numpngw` - -## TODO -Fix the movie table -Consider re-adding the following modules: `etymology, ip` -Add CTCP responses -More complex versioning +Python packages: `twisted python-dateutil requests bs4 wolframalpha emoji pillow ipython numpy numpngw` diff --git a/modules/countdown.py b/modules/countdown.py deleted file mode 100755 index 460872c..0000000 --- a/modules/countdown.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 -""" -Provides a countdown to some particular date. -""" -from datetime import datetime - -from module import commands, example -from tools.time import relativeTime - - -@commands("countdown") -@example(".countdown 2012 12 21") -def generic_countdown(bot, trigger): - """ - .countdown - displays a countdown to a given date. - """ - if len(trigger.args) < 2: - return bot.msg("Please use correct format: .countdown 2012 12 21") - text = trigger.args[1] - - text = text.split() - if (len(text) != 3 or not text[0].isdigit() or not text[1].isdigit() - or not text[2].isdigit()): - return bot.msg("Please use correct format: .countdown 2012 12 21") - try: - date = datetime(int(text[0]), int(text[1]), int(text[2])) - except: - return bot.msg("Please use correct format: .countdown 2012 12 21") - - msg = relativeTime(datetime.now(), date) - msg += " until " + trigger.args[1] - bot.msg(msg) diff --git a/modules/iot.py b/modules/iot.py deleted file mode 100755 index 2f065b3..0000000 --- a/modules/iot.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python3 -""" -Long live the Internet of Things! -""" -import requests - -import module - - -@module.require_admin -@module.commands('lamp') -def lampToggle(bot, trigger): - """ - Turns my lamp on and off. The glory of IoT! - """ - try: - res = requests.get("http://192.168.1.12/gpio?0=toggle", timeout=10) - except requests.exceptions.ReadTimeout: - return bot.msg("Connection error. Timeout reached.") - except requests.exceptions.ConnectionError: - return bot.msg("Connection error. Is the unit dead?") - if res.text[32] == 'L': - bot.msg("Lamp is now OFF.") - elif res.text[32] == 'H': - bot.msg("Lamp is now ON.") - - -#@module.require_admin -@module.commands('roomtemp') -def roomTemp(bot, trigger): - """ - Gets the temperature of my room. - """ - try: - res = requests.get("http://192.168.1.25/", timeout=10) - except requests.exceptions.ReadTimeout: - return bot.msg("Connection error. Timeout reached.") - except requests.exceptions.ConnectionError: - return bot.msg("Connection error. Is the unit dead?") - bot.msg(res.text) - - -@module.require_admin -@module.commands('inkwrite') -def inkWrite(bot, trigger): - """ - Writes shit to my e-ink screen. - """ - text = trigger.replace(".inkwrite ", "") - if not text: - return bot.msg("Need something to write.") - - try: - res = requests.get(f"http://192.168.1.125:8000/?text={text}", - timeout=10) - except requests.exceptions.ReadTimeout: - return bot.msg("Connection error. Timeout reached.") - except requests.exceptions.ConnectionError: - return bot.msg("Connection error. Is the unit dead?") - bot.msg("Wrote: " + res.text) diff --git a/modules/lmgtfy.py b/modules/lmgtfy.py deleted file mode 100755 index e341da8..0000000 --- a/modules/lmgtfy.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -""" -Let me google that for you. -""" -from module import commands - -@commands('lmgtfy') -def googleit(bot, trigger): - """Let me just... google that for you.""" - if len(trigger.args) < 2: - return bot.msg('http://google.com/') - bot.msg('http://lmgtfy.com/?q=' + trigger.args[1].replace(' ', '+')) diff --git a/modules/minecraft.py b/modules/minecraft.py deleted file mode 100755 index ab3a72e..0000000 --- a/modules/minecraft.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python3 -""" -Minecraft is a well-crafted program. -""" -import subprocess - -import module - - -@module.require_admin -@module.commands('mc_start') -def minecraft_start_server(bot, trigger): - """ - Starts the minecraft server in case it crashes. - """ - cmd = ["tmux", "send", "-t", "main:2", "./start.sh", "ENTER"] - cmd_re = ["tmux", "send", "-t", "main:2", "^C", "ENTER"] - msg = "Start signal sent to the minecraft server." - if len(trigger.args) >= 2: - msg = "Re-" + msg - subprocess.run(cmd_re, check=True) - subprocess.run(cmd, check=True) - bot.msg(msg) diff --git a/modules/spellcheck.py b/modules/spellcheck.py deleted file mode 100755 index 0a243ec..0000000 --- a/modules/spellcheck.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python3 -""" -Spell checking. Relies on the pyenchant module. -""" -import enchant - -from module import commands, example - -@commands('spellcheck', 'spell') -@example('.spellcheck stuff') -def spellcheck(bot, trigger): - """ - Says whether the given word is spelled correctly, and gives suggestions if - it's not. - """ - if len(trigger.args) < 2: - return bot.reply("What word?") - word = trigger.args[1] - if " " in word: - return bot.msg("One word at a time, please") - dictionary = enchant.Dict("en_US") - - if dictionary.check(word): - bot.msg(word + " is spelled correctly") - else: - msg = f"{word} is not spelled correctly. Maybe you want one of " \ - + "these spellings: " - sugWords = [] - for suggested_word in dictionary.suggest(word): - sugWords.append(suggested_word) - msg += ", ".join(sugWords) - bot.msg(msg) diff --git a/modules/version.py b/modules/version.py deleted file mode 100755 index c9333f0..0000000 --- a/modules/version.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 -""" -The bot's version number. -""" -from module import commands - -@commands('version') -def version(bot, trigger): - """Displays the current version of Fulvia running.""" - bot.reply("Fulvia v1.0.0")