remove some old modules

This commit is contained in:
iou1name 2020-01-08 07:18:23 -05:00
parent 1b71e73757
commit c33cd58f4e
7 changed files with 1 additions and 177 deletions

View File

@ -3,11 +3,4 @@ It's like Sopel, except rewritten from scratch using Twisted as a base and over
## Requirements ## Requirements
Python 3.6+ Python 3.6+
System packages: `enchant` Python packages: `twisted python-dateutil requests bs4 wolframalpha emoji pillow ipython numpy numpngw`
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

View File

@ -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 <year> <month> <day> - 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)

View File

@ -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)

View File

@ -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(' ', '+'))

View File

@ -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)

View File

@ -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)

View File

@ -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")