From 55087c42ed74df95e4fbcd647d85aebd64afafcb Mon Sep 17 00:00:00 2001 From: iou1name Date: Fri, 25 May 2018 15:21:18 -0400 Subject: [PATCH] changed bot.say to bot.msg --- README.md | 2 +- bot.py | 17 ----------------- module.py | 10 +++++----- modules/ascii.py | 10 +++++----- modules/away.py | 2 +- modules/banhe.py | 12 ++++++------ modules/bq.py | 2 +- modules/calc.py | 6 +++--- modules/countdown.py | 8 ++++---- modules/echo.py | 2 +- modules/grog.py | 2 +- modules/hangman.py | 12 ++++++------ modules/iot.py | 22 +++++++++++----------- modules/ipython.py | 4 ++-- modules/isup.py | 12 ++++++------ modules/lmgtfy.py | 4 ++-- modules/movie.py | 4 ++-- modules/pingall.py | 2 +- modules/remind.py | 10 +++++----- modules/resistor.py | 10 +++++----- modules/rundown.py | 2 +- modules/scramble.py | 8 ++++---- modules/sed.py | 2 +- modules/seen.py | 2 +- modules/spellcheck.py | 4 ++-- modules/tld.py | 2 +- modules/topic.py | 4 ++-- modules/translate.py | 2 +- modules/unicode_info.py | 2 +- modules/uptime.py | 4 ++-- modules/url.py | 2 +- modules/watcher.py | 10 +++++----- modules/weather.py | 2 +- modules/wikipedia.py | 2 +- modules/wiktionary.py | 4 ++-- modules/willilike.py | 2 +- modules/wolfram.py | 2 +- 37 files changed, 96 insertions(+), 113 deletions(-) diff --git a/README.md b/README.md index 8914c02..ed98afc 100755 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ TODO: Fix the movie table Consider re-adding the following modules: `etymology, ip` Consider logging -Change `bot.say` to `bot.msg` +Change `bot.msg` to `bot.msg` Add CTCP responses More complex versioning Better readme diff --git a/bot.py b/bot.py index a13d9ea..55bbad2 100755 --- a/bot.py +++ b/bot.py @@ -357,14 +357,6 @@ class Fulvia(irc.IRCClient): irc.IRCClient.msg(self, user, message, length=None) - def say(self, text, recipient, max_messages=None): - """ - For compatibility with most of the sopel modules. Will phase it out - in favor of self.msg eventually. - """ - # TODO: change everything to use bot.msg() - self.msg(recipient, text) - def reply(self, text, dest, reply_to, notice=False): """ For compatibility with most of the sopel modules. Will phase it out @@ -432,15 +424,6 @@ class FulviaWrapper(): user = self._trigger.channel self._bot.msg(user, message, length) - def say(self, message, destination=None, max_messages=1): - """ - If destination is None, it defaults to the channel the message - was received on. - """ - if destination is None: - destination = self._trigger.channel - self._bot.say(message, destination, max_messages) - def reply(self, message, destination=None, reply_to=None, notice=False): """ If destination is None, it defaults to the channel the message diff --git a/module.py b/module.py index 8ca17a9..03fb0bd 100755 --- a/module.py +++ b/module.py @@ -115,7 +115,7 @@ def require_privmsg(message=None): return function(*args, **kwargs) else: if message and not callable(message): - bot.say(message) + bot.msg(message) return _nop # Hack to allow decorator without parens if callable(message): @@ -138,7 +138,7 @@ def require_chanmsg(message=None): return function(*args, **kwargs) else: if message and not callable(message): - bot.say(message) + bot.msg(message) return _nop # Hack to allow decorator without parens if callable(message): @@ -168,7 +168,7 @@ def require_privilege(level, message=None): allowed = channel_privs.get(trigger.nick, 0) >= level if not allowed: if message and not callable(message): - bot.say(message) + bot.msg(message) else: return function(bot, trigger, *args, **kwargs) return guarded @@ -188,7 +188,7 @@ def require_admin(message=None): def guarded(bot, trigger, *args, **kwargs): if not trigger.admin: if message and not callable(message): - bot.say(message) + bot.msg(message) else: return function(bot, trigger, *args, **kwargs) return guarded @@ -211,7 +211,7 @@ def require_owner(message=None): def guarded(bot, trigger, *args, **kwargs): if not trigger.owner: if message and not callable(message): - bot.say(message) + bot.msg(message) else: return function(bot, trigger, *args, **kwargs) return guarded diff --git a/modules/ascii.py b/modules/ascii.py index 3108297..c76ab44 100755 --- a/modules/ascii.py +++ b/modules/ascii.py @@ -234,7 +234,7 @@ def ascii(bot, trigger): Downloads an image and converts it to ascii. """ if not trigger.group(2): - return bot.say() + return bot.msg() parser = argparse.ArgumentParser(add_help=False) parser.add_argument("imagePath") parser.add_argument("-r", "--reverse", action="store_true", help="Reverse.") @@ -246,7 +246,7 @@ def ascii(bot, trigger): args = parser.parse_args(trigger.group(2).split()) if args.help: - return bot.say(parser.print_help()) + return bot.msg(parser.print_help()) if args.color: args.color = "irc" @@ -260,15 +260,15 @@ def ascii(bot, trigger): handle_gif(**vars(args)) file = {"file": open("temp.png", "rb")} res = requests.post("https://uguu.se/api.php?d=upload-tool", files=file) - bot.say(res.text) + bot.msg(res.text) elif args.brail2: image = open_image(args.imagePath) image_ascii = image_to_brail(image) image_ascii = image_ascii.replace("⠀"," ") - bot.say(image_ascii) + bot.msg(image_ascii) else: image_ascii = image_to_ascii(None, **vars(args)) - bot.say(image_ascii) + bot.msg(image_ascii) def brail_char(chunk, threshold): diff --git a/modules/away.py b/modules/away.py index 080de2f..13c69d9 100755 --- a/modules/away.py +++ b/modules/away.py @@ -33,7 +33,7 @@ def message(bot, trigger): if name in bot.memory["away"]: print(True) msg = f"\x0308{name}\x03 is away: \x0311{bot.memory['away'][name]}" - bot.say(msg) + bot.msg(msg) @hook(True) diff --git a/modules/banhe.py b/modules/banhe.py index 9f4248f..3f82da4 100755 --- a/modules/banhe.py +++ b/modules/banhe.py @@ -33,12 +33,12 @@ def banhe(bot, trigger): if period > 2592000: bot.reply("It's too big, Onii-chan.") if not period or period > 2592000: - return bot.say(f"Banned \x0304{banhee}\x03 for \x0309∞\x03 seconds.") + return bot.msg(f"Banned \x0304{banhee}\x03 for \x0309∞\x03 seconds.") - bot.say(f"Banned \x0304{banhee}\x03 for \x0309{str(period)}\x03 seconds.") + bot.msg(f"Banned \x0304{banhee}\x03 for \x0309{str(period)}\x03 seconds.") time.sleep(period) bot.mode(trigger.channel, False, "b", mask=banmask) - bot.say(f"Unbanned \x0304{banhee}\x03") + bot.msg(f"Unbanned \x0304{banhee}\x03") @require_admin @@ -61,13 +61,13 @@ def banheall(bot, trigger): if period > 2592000: bot.reply("It's too big, Onii-chan.") if not period or period > 2592000: - return bot.say("Banned \x0304them all\x03 for \x0309∞\x03 seconds.") + return bot.msg("Banned \x0304them all\x03 for \x0309∞\x03 seconds.") - bot.say(f"Banned \x0304them all\x03 for \x0309{str(period)}\x03 seconds.") + bot.msg(f"Banned \x0304them all\x03 for \x0309{str(period)}\x03 seconds.") time.sleep(period) for nick in bot.channels[trigger.channel].users: banmask = configureHostMask(nick) bot.mode(trigger.channel, False, "b", mask=banmask) - bot.say("Unbanned \x0304them all\x03") + bot.msg("Unbanned \x0304them all\x03") diff --git a/modules/bq.py b/modules/bq.py index e39a9df..2b1eea5 100755 --- a/modules/bq.py +++ b/modules/bq.py @@ -16,4 +16,4 @@ def BQstatus(bot, trigger): deathdate = "[2017-02-16 00:19:00]" msg = "Banished Quest status: " + status + "\nTime since death: " msg += relativeTime(bot.config, datetime.now(), deathdate) + " ago" - bot.say(msg) + bot.msg(msg) diff --git a/modules/calc.py b/modules/calc.py index e4ae071..e1f23a4 100755 --- a/modules/calc.py +++ b/modules/calc.py @@ -34,7 +34,7 @@ def c(bot, trigger): def py(bot, trigger): """Evaluate a Python expression.""" if not trigger.group(2): - return bot.say("Need an expression to evaluate") + return bot.msg("Need an expression to evaluate") query = trigger.group(2) uri = BASE_TUMBOLIA_URI + 'py/' @@ -42,7 +42,7 @@ def py(bot, trigger): res.raise_for_status() answer = res.text if answer: - #bot.say can potentially lead to 3rd party commands triggering. - bot.say(answer) + #bot.msg can potentially lead to 3rd party commands triggering. + bot.msg(answer) else: bot.reply('Sorry, no result.') diff --git a/modules/countdown.py b/modules/countdown.py index 0bb2645..5eb200a 100755 --- a/modules/countdown.py +++ b/modules/countdown.py @@ -16,17 +16,17 @@ def generic_countdown(bot, trigger): """ text = trigger.group(2) if not text: - return bot.say("Please use correct format: .countdown 2012 12 21") + return bot.msg("Please use correct format: .countdown 2012 12 21") text = text.split() if (len(text) != 3 or not text[0].isdigit() or not text[1].isdigit() or not text[2].isdigit()): - return bot.say("Please use correct format: .countdown 2012 12 21") + 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.say("Please use correct format: .countdown 2012 12 21") + return bot.msg("Please use correct format: .countdown 2012 12 21") msg = relativeTime(bot.config, datetime.now(), date) msg += " until " + trigger.group(2) - bot.say(msg) + bot.msg(msg) diff --git a/modules/echo.py b/modules/echo.py index 5672e55..309b55e 100755 --- a/modules/echo.py +++ b/modules/echo.py @@ -9,4 +9,4 @@ from module import commands, example def echo(bot, trigger): """Echos the given string.""" if trigger.group(2): - bot.say(trigger.group(2)) + bot.msg(trigger.group(2)) diff --git a/modules/grog.py b/modules/grog.py index 721212d..9084236 100755 --- a/modules/grog.py +++ b/modules/grog.py @@ -24,4 +24,4 @@ def grog(bot, trigger): num = random.randint(0, len(data)-1) if num >= len(data)-1: num = len(data)-1 - bot.say(data[num]) + bot.msg(data[num]) diff --git a/modules/hangman.py b/modules/hangman.py index 5d5a63c..ee43570 100755 --- a/modules/hangman.py +++ b/modules/hangman.py @@ -51,7 +51,7 @@ def hangman(bot, trigger): msg = f"{trigger.nick} has started a game of hangman! " \ + "Use '.hangman [guess]' to guess a letter or the entire word." bot.msg(msg) - bot.say("".join(bot.memory["hangman"][trigger.channel].blanks)) + bot.msg("".join(bot.memory["hangman"][trigger.channel].blanks)) return if not bot.memory["hangman"].get(trigger.channel): @@ -61,8 +61,8 @@ def hangman(bot, trigger): if len(trigger.group(2)) > 1: if trigger.group(2) == bot.memory["hangman"][trigger.channel].word: - bot.say(f"{trigger.nick} has won!") - bot.say(bot.memory["hangman"][trigger.channel].word) + bot.msg(f"{trigger.nick} has won!") + bot.msg(bot.memory["hangman"][trigger.channel].word) bot.memory["hangman"].pop(trigger.channel) return else: @@ -82,8 +82,8 @@ def hangman(bot, trigger): bot.reply(msg) if bot.memory["hangman"][trigger.channel].tries <= 0: - bot.say("Game over!") - bot.say(bot.memory['hangman'][trigger.channel].word) + bot.msg("Game over!") + bot.msg(bot.memory['hangman'][trigger.channel].word) bot.memory["hangman"].pop(trigger.channel) else: - bot.say("".join(bot.memory["hangman"][trigger.channel].blanks)) + bot.msg("".join(bot.memory["hangman"][trigger.channel].blanks)) diff --git a/modules/iot.py b/modules/iot.py index ca4aaef..2f065b3 100755 --- a/modules/iot.py +++ b/modules/iot.py @@ -16,13 +16,13 @@ def lampToggle(bot, trigger): try: res = requests.get("http://192.168.1.12/gpio?0=toggle", timeout=10) except requests.exceptions.ReadTimeout: - return bot.say("Connection error. Timeout reached.") + return bot.msg("Connection error. Timeout reached.") except requests.exceptions.ConnectionError: - return bot.say("Connection error. Is the unit dead?") + return bot.msg("Connection error. Is the unit dead?") if res.text[32] == 'L': - bot.say("Lamp is now OFF.") + bot.msg("Lamp is now OFF.") elif res.text[32] == 'H': - bot.say("Lamp is now ON.") + bot.msg("Lamp is now ON.") #@module.require_admin @@ -34,10 +34,10 @@ def roomTemp(bot, trigger): try: res = requests.get("http://192.168.1.25/", timeout=10) except requests.exceptions.ReadTimeout: - return bot.say("Connection error. Timeout reached.") + return bot.msg("Connection error. Timeout reached.") except requests.exceptions.ConnectionError: - return bot.say("Connection error. Is the unit dead?") - bot.say(res.text) + return bot.msg("Connection error. Is the unit dead?") + bot.msg(res.text) @module.require_admin @@ -48,13 +48,13 @@ def inkWrite(bot, trigger): """ text = trigger.replace(".inkwrite ", "") if not text: - return bot.say("Need something to write.") + 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.say("Connection error. Timeout reached.") + return bot.msg("Connection error. Timeout reached.") except requests.exceptions.ConnectionError: - return bot.say("Connection error. Is the unit dead?") - bot.say("Wrote: " + res.text) + return bot.msg("Connection error. Is the unit dead?") + bot.msg("Wrote: " + res.text) diff --git a/modules/ipython.py b/modules/ipython.py index 55d4076..6d8cf64 100755 --- a/modules/ipython.py +++ b/modules/ipython.py @@ -16,7 +16,7 @@ def interactive_shell(bot, trigger): Starts an interactive IPython console """ if bot.memory['iconsole_running']: - return bot.say('Console already running') + return bot.msg('Console already running') banner1 = 'Fulvia interactive shell (embedded IPython)' banner2 = '`bot` and `trigger` are available. To exit, type exit' @@ -26,6 +26,6 @@ def interactive_shell(bot, trigger): exit_msg=exitmsg) bot.memory['iconsole_running'] = True - bot.say('console started') + bot.msg('console started') console() bot.memory['iconsole_running'] = False diff --git a/modules/isup.py b/modules/isup.py index 82a943d..73b110a 100755 --- a/modules/isup.py +++ b/modules/isup.py @@ -24,21 +24,21 @@ def isup(bot, trigger): res = requests.head(url, timeout=10, verify=True) except (requests.exceptions.MissingSchema, requests.exceptions.InvalidSchema): - return bot.say("Missing or invalid schema. Check the URL.") + return bot.msg("Missing or invalid schema. Check the URL.") except requests.exceptions.ConnectionError: - return bot.say("Connection error. Are you sure this is a real website?") + return bot.msg("Connection error. Are you sure this is a real website?") except requests.exceptions.InvalidURL: - return bot.say("Invalid URL.") + return bot.msg("Invalid URL.") except Exception as e: print(e) - return bot.say("Listen buddy. I don't know what you're doing, but \ + return bot.msg("Listen buddy. I don't know what you're doing, but \ you're not doing it right.") try: res.raise_for_status() - return bot.say(url + " appears to be working from here.") + return bot.msg(url + " appears to be working from here.") except requests.exceptions.HTTPError: - return bot.say(url + " looks down from here.") + return bot.msg(url + " looks down from here.") diff --git a/modules/lmgtfy.py b/modules/lmgtfy.py index 4f352fb..aefa9c2 100755 --- a/modules/lmgtfy.py +++ b/modules/lmgtfy.py @@ -8,5 +8,5 @@ from module import commands def googleit(bot, trigger): """Let me just... google that for you.""" if not trigger.group(2): - return bot.say('http://google.com/') - bot.say('http://lmgtfy.com/?q=' + trigger.group(2).replace(' ', '+')) + return bot.msg('http://google.com/') + bot.msg('http://lmgtfy.com/?q=' + trigger.group(2).replace(' ', '+')) diff --git a/modules/movie.py b/modules/movie.py index 2dbfdce..ad050db 100755 --- a/modules/movie.py +++ b/modules/movie.py @@ -88,7 +88,7 @@ def movieInfo(bot, trigger): msg += "\n\x0310Overview\x03: " + data['overview'] - bot.say(msg) + bot.msg(msg) def phyiscalRelease(word, tmdb_id=None, api_key=None): @@ -171,4 +171,4 @@ def addMovie(bot, trigger): except IntegrityError: confirm = f"Error: {movie} is already in the database." bot.memory['movie_lock'].release() - bot.say(confirm) + bot.msg(confirm) diff --git a/modules/pingall.py b/modules/pingall.py index 5a9fd6a..f52d3a0 100755 --- a/modules/pingall.py +++ b/modules/pingall.py @@ -15,4 +15,4 @@ def pingAll(bot, trigger): names.remove("Ishd") if "Ishd2" in names: names.remove("Ishd2") - bot.say(" ".join(names)) + bot.msg(" ".join(names)) diff --git a/modules/remind.py b/modules/remind.py index 5091240..2cb3aeb 100755 --- a/modules/remind.py +++ b/modules/remind.py @@ -158,9 +158,9 @@ periods = '|'.join(scaling.keys()) def remind(bot, trigger): """Gives you a reminder in the given amount of time.""" if not trigger.group(2): - return bot.say("Missing arguments for reminder command.") + return bot.msg("Missing arguments for reminder command.") if trigger.group(3) and not trigger.group(4): - return bot.say("No message given for reminder.") + return bot.msg("No message given for reminder.") duration = 0 message = filter(None, re.split(f"(\d+(?:\.\d+)? ?(?:(?i) {periods})) ?", @@ -197,9 +197,9 @@ def at(bot, trigger): clock format only. """ if not trigger.group(2): - return bot.say("No arguments given for reminder command.") + return bot.msg("No arguments given for reminder command.") if trigger.group(3) and not trigger.group(4): - return bot.say("No message given for reminder.") + return bot.msg("No message given for reminder.") regex = re.compile(r"(\d+):(\d+)(?::(\d+))?(?:UTC([+-]\d+))? (.*)") match = regex.match(trigger.group(2)) @@ -214,7 +214,7 @@ def at(bot, trigger): try: tz = int(tz.replace("UTC", "")) except ValueError: - bot.say("Invalid timezone. Using the bot's current timezone.") + bot.msg("Invalid timezone. Using the bot's current timezone.") tz = None if tz: diff --git a/modules/resistor.py b/modules/resistor.py index d77f32d..07f353e 100755 --- a/modules/resistor.py +++ b/modules/resistor.py @@ -61,7 +61,7 @@ def resist(bot, trigger): Displays the color band code of a resistor for the given resistance. """ if not trigger.group(2): - return bot.say("Please specify a value") + return bot.msg("Please specify a value") parser = argparse.ArgumentParser() parser.add_argument("value", nargs="+") parser.add_argument("-r", "--reverse", action="store_true") @@ -69,10 +69,10 @@ def resist(bot, trigger): args = parser.parse_args(trigger.group(2).split()) if args.reverse: # bands-to-value - bot.say(bands_to_value(" ".join(args.value))) + bot.msg(bands_to_value(" ".join(args.value))) else: # value-to-band if len(args.value) > 1: - return bot.say("Too many values.") + return bot.msg("Too many values.") value = args.value[0].lower() mul = 1 @@ -82,8 +82,8 @@ def resist(bot, trigger): try: value = float(value) * mul except ValueError: - return bot.say("Invalid input.") - return bot.say(value_to_band(value, args.num_bands)) + return bot.msg("Invalid input.") + return bot.msg(value_to_band(value, args.num_bands)) def value_to_band(value, num_bands=4): diff --git a/modules/rundown.py b/modules/rundown.py index aea7803..e662dd7 100755 --- a/modules/rundown.py +++ b/modules/rundown.py @@ -19,4 +19,4 @@ def rundown(bot, trigger): else: with open(os.path.join(bot.static, "rundown.txt"), "r") as file: data = file.read() - bot.say(data) + bot.msg(data) diff --git a/modules/scramble.py b/modules/scramble.py index 6b7e247..a45f64f 100755 --- a/modules/scramble.py +++ b/modules/scramble.py @@ -65,7 +65,7 @@ def scramble(bot, trigger): msg = f"{trigger.nick} has started a game of scramble! " \ + "Use '.scramble [guess]' to guess a letter or the entire word." bot.msg(msg) - bot.say(bot.memory["scramble"][trigger.channel].shuffled) + bot.msg(bot.memory["scramble"][trigger.channel].shuffled) return if not bot.memory["scramble"].get(trigger.channel): @@ -75,11 +75,11 @@ def scramble(bot, trigger): word = bot.memory["scramble"][trigger.channel].word if isAnagram(bot, word, trigger.group(2)): - bot.say(f"{trigger.nick} has won!") + bot.msg(f"{trigger.nick} has won!") msg = "Original word: " \ + bot.memory["scramble"][trigger.channel].word - bot.say(msg) + bot.msg(msg) bot.memory["scramble"].pop(trigger.channel) else: bot.reply("Incorrect.") - bot.say(bot.memory["scramble"][trigger.channel].shuffled) + bot.msg(bot.memory["scramble"][trigger.channel].shuffled) diff --git a/modules/sed.py b/modules/sed.py index ba7efa4..6a7f8dc 100755 --- a/modules/sed.py +++ b/modules/sed.py @@ -139,4 +139,4 @@ def findandreplace(bot, trigger): else: phrase = f"{trigger.nick} {new_phrase}" - bot.say(phrase) + bot.msg(phrase) diff --git a/modules/seen.py b/modules/seen.py index 7e1ea79..245976a 100755 --- a/modules/seen.py +++ b/modules/seen.py @@ -98,7 +98,7 @@ def seen(bot, trigger): if args.message: msg += f'\x03 with "\x0308{message}\x03"' - bot.say(msg) + bot.msg(msg) def dump_seen_db(bot): diff --git a/modules/spellcheck.py b/modules/spellcheck.py index d380143..d68d112 100755 --- a/modules/spellcheck.py +++ b/modules/spellcheck.py @@ -17,11 +17,11 @@ def spellcheck(bot, trigger): return bot.reply("What word?") word = trigger.group(2) if " " in word: - return bot.say("One word at a time, please") + return bot.msg("One word at a time, please") dictionary = enchant.Dict("en_US") if dictionary.check(word): - bot.say(word + " is spelled correctly") + bot.msg(word + " is spelled correctly") else: msg = f"{word} is not spelled correctly. Maybe you want one of " \ + "these spellings: " diff --git a/modules/tld.py b/modules/tld.py index 0f0ee4e..c70ce36 100755 --- a/modules/tld.py +++ b/modules/tld.py @@ -27,7 +27,7 @@ def gettld(bot, trigger): td = soup.find("td", string=word) if not td: - return bot.say(f"Unable to find data for TLD: {word}") + return bot.msg(f"Unable to find data for TLD: {word}") table_headers = [th.string for th in td.parent.parent.find_all("th")] if None in table_headers: diff --git a/modules/topic.py b/modules/topic.py index 2191300..f3bfcba 100755 --- a/modules/topic.py +++ b/modules/topic.py @@ -50,7 +50,7 @@ def addTopic(bot, trigger): """ topic = trigger.group(2) if not topic: - return bot.say("Please be providing a topic sir.") + return bot.msg("Please be providing a topic sir.") bot.memory['topic_lock'].acquire() try: bot.db.execute("INSERT INTO topic (topic, added_by) VALUES(?,?)", @@ -59,4 +59,4 @@ def addTopic(bot, trigger): except IntegrityError: confirm = "Error: " + topic + " is already in the database." bot.memory['topic_lock'].release() - bot.say(confirm) + bot.msg(confirm) diff --git a/modules/translate.py b/modules/translate.py index 7f4c1a8..4c57080 100755 --- a/modules/translate.py +++ b/modules/translate.py @@ -49,7 +49,7 @@ def tr2(bot, trigger): tr_text, in_lang = translate(args.text, in_lang=args.inlang, out_lang=args.outlang) - bot.say(f'"{tr_text}" ({in_lang} to {args.outlang})') + bot.msg(f'"{tr_text}" ({in_lang} to {args.outlang})') @commands('mangle') diff --git a/modules/unicode_info.py b/modules/unicode_info.py index ca3a513..883dc0d 100755 --- a/modules/unicode_info.py +++ b/modules/unicode_info.py @@ -38,4 +38,4 @@ def codepoint(bot, trigger): template = 'U+%s %s (%s)' else: template = 'U+%s %s (\xe2\x97\x8c%s)' - bot.say(template % (point, name, arg)) + bot.msg(template % (point, name, arg)) diff --git a/modules/uptime.py b/modules/uptime.py index 2062b6d..0ec464f 100755 --- a/modules/uptime.py +++ b/modules/uptime.py @@ -17,11 +17,11 @@ def uptime(bot, trigger): """.uptime - Returns the uptime of Fulvia.""" delta = datetime.timedelta(seconds=round((datetime.datetime.now() - bot.memory["uptime"]).total_seconds())) - bot.say(f"I've been sitting here for {delta} and I keep going!") + bot.msg(f"I've been sitting here for {delta} and I keep going!") @commands('updick') def updick(bot, trigger): """.updick - Returns the uptime of Fulvia, measured in dicks.""" delta = datetime.datetime.now() - bot.memory["uptime"] - bot.say("8" + "="*delta.days + "D") + bot.msg("8" + "="*delta.days + "D") diff --git a/modules/url.py b/modules/url.py index 797b812..c04d1ca 100755 --- a/modules/url.py +++ b/modules/url.py @@ -50,4 +50,4 @@ def title_auto(bot, trigger): title = HTMLParser().unescape(title) title = title.replace("\n","").strip() hostname = urlparse(url).hostname - bot.say(f"[ \x0310{title} \x03] - \x0304{hostname}") + bot.msg(f"[ \x0310{title} \x03] - \x0304{hostname}") diff --git a/modules/watcher.py b/modules/watcher.py index 8d44a51..f7a4e6a 100755 --- a/modules/watcher.py +++ b/modules/watcher.py @@ -90,12 +90,12 @@ def watch(bot, trigger): name = "Anonymous" if url in bot.memory["watcher"].keys(): - return bot.say("Error: I'm already watching that thread.") + return bot.msg("Error: I'm already watching that thread.") api_url = get_api_url(url) res = requests.get(api_url, verify=True) if res.status_code == 404: - return bot.say("404: thread not found") + return bot.msg("404: thread not found") thread = res.json() last_post = get_last_post(thread, name) @@ -108,7 +108,7 @@ def watch(bot, trigger): bot.db.execute("INSERT INTO watcher(api_url, name, last_post, time_since)" " VALUES(?,?,?,?,?)", (api_url, name, last_post, time_since)) - bot.say("[\x0304Watcher\x03] Watching thread: \x0307" + url) + bot.msg("[\x0304Watcher\x03] Watching thread: \x0307" + url) @commands("unwatch") @@ -122,9 +122,9 @@ def unwatch(bot, trigger): bot.memory["watcher"][url].stop.set() bot.memory["watcher"].pop(url) except KeyError: - return bot.say("Error: I'm not watching that thread.") + return bot.msg("Error: I'm not watching that thread.") removeThread(bot, get_api_url(url),) - bot.say("[\x0304Watcher\x03] No longer watching: \x0307" + url) + bot.msg("[\x0304Watcher\x03] No longer watching: \x0307" + url) diff --git a/modules/weather.py b/modules/weather.py index e932c49..c663a92 100755 --- a/modules/weather.py +++ b/modules/weather.py @@ -141,4 +141,4 @@ def weather(bot, trigger): temp = get_temp(results) humidity = get_humidity(results) wind = get_wind(results) - bot.say(u'%s: %s, %s, %s, %s' % (location, cover, temp, humidity, wind)) + bot.msg(u'%s: %s, %s, %s, %s' % (location, cover, temp, humidity, wind)) diff --git a/modules/wikipedia.py b/modules/wikipedia.py index fa3c218..2f3d9f3 100755 --- a/modules/wikipedia.py +++ b/modules/wikipedia.py @@ -33,7 +33,7 @@ def say_snippet(bot, query, show_url=True): msg = f'[\x0304WIKIPEDIA\x03] \x0310{page_name}\x03 | \x0312"{snippet}"' if show_url: msg = msg + f"\x03 | \x0307https://en.wikipedia.org/wiki/{query}" - bot.say(msg) + bot.msg(msg) def wiki_snippet(query): diff --git a/modules/wiktionary.py b/modules/wiktionary.py index ed661d6..23b6182 100755 --- a/modules/wiktionary.py +++ b/modules/wiktionary.py @@ -82,7 +82,7 @@ def wiktionary(bot, trigger): _, definitions = wikt(word) if not definitions: - return bot.say(f"Couldn't get any definitions for {word}.") + return bot.msg(f"Couldn't get any definitions for {word}.") result = format(word, definitions) if len(result) < 150: @@ -92,4 +92,4 @@ def wiktionary(bot, trigger): if len(result) > 300: result = result[:295] + '[...]' - bot.say(result) + bot.msg(result) diff --git a/modules/willilike.py b/modules/willilike.py index ced4178..9a5966f 100755 --- a/modules/willilike.py +++ b/modules/willilike.py @@ -15,4 +15,4 @@ def willilike(bot, trigger): @example('.willilike Banished Quest') def upvote(bot, trigger): """An advanced AI that will determine if you like something.""" - bot.say(trigger.nick + " upvoted this post!") + bot.msg(trigger.nick + " upvoted this post!") diff --git a/modules/wolfram.py b/modules/wolfram.py index 63f17d8..adca29c 100755 --- a/modules/wolfram.py +++ b/modules/wolfram.py @@ -25,7 +25,7 @@ def wa_command(bot, trigger): res = wa_query(query, app_id, units) - bot.say(f"[\x0304Wolfram\x03] {res}") + bot.msg(f"[\x0304Wolfram\x03] {res}") def wa_query(query, app_id, units='nonmetric'):