From 7d6214a88a9d3103d6d1fb7c60a58c82322ab994 Mon Sep 17 00:00:00 2001 From: nex Date: Fri, 24 Feb 2023 08:40:25 +0000 Subject: [PATCH] insulting people is fun --- cogs/events.py | 15 ++++++++++++++- utils/client.py | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cogs/events.py b/cogs/events.py index 07d2a8d..b90417d 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -1,4 +1,5 @@ import random +import textwrap from pathlib import Path from typing import Optional, Tuple import discord @@ -93,6 +94,7 @@ class Events(commands.Cog): await message.delete(delay=1) else: + # Respond to shronk bot if message.author.id == 1063875884274163732 and message.channel.can_send(): RESPONSES = { "Congratulations!!": "Shut up SHRoNK Bot, nobody loves you.", @@ -103,10 +105,12 @@ class Events(commands.Cog): if k in message.content: await message.reply(v, delete_after=10) break + # Stop responding to any bots if message.author.bot is True: return + # Only respond if the message has content... if message.content: - if message.channel.can_send(): + if message.channel.can_send(): # ... and we can send messages if "linux" in message.content.lower() and self.bot.user in message.mentions: console.log(f"Responding to {message.author} with linux copypasta") try: @@ -120,6 +124,15 @@ class Events(commands.Cog): if "carat" in message.content.lower(): file = discord.File(Path(__file__).parent.parent / "carat.jpg") await message.reply(file=file) + if message.reference is not None and message.reference.cached_message is not None: + if message.content.lower().strip() in ("what", "what?"): + text = "{0.author.mention} said %r, you deaf sod.".format( + message.reference.cached_message + ) + _content = textwrap.shorten( + text % message.reference.cached_message.content, width=2000, placeholder="[...]" + ) + await message.reply(_content) if message.channel.permissions_for(message.guild.me).add_reactions: if "mpreg" in message.content.lower() or "\U0001fac3" in message.content.lower(): try: diff --git a/utils/client.py b/utils/client.py index 076acd5..1be0dc8 100644 --- a/utils/client.py +++ b/utils/client.py @@ -56,8 +56,8 @@ class Bot(commands.Bot): await super().on_error(event, *args, **kwargs) async def close(self) -> None: + await self.http.close() if getattr(self, "web", None) is not None: - await self.http.close() self.console.log("Closing web server...") await self.web["server"].shutdown() self.web["task"].cancel()