1
0
Fork 0

Fix private messages

This commit is contained in:
Ethanell 2020-07-23 21:32:43 +02:00
parent 8fda6e37bb
commit 14f2ab7e3f
3 changed files with 22 additions and 19 deletions

View file

@ -1,6 +1,7 @@
from discord import Embed
from discord.ext import commands
from discord.ext.commands import CommandNotFound, MissingRequiredArgument, BadArgument, MissingPermissions
from discord.ext.commands import CommandNotFound, MissingRequiredArgument, BadArgument, MissingPermissions, \
NoPrivateMessage
from administrator import config
from administrator.logger import logger
@ -14,7 +15,6 @@ logger = logger.getChild(extension_name)
class Help(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
self.purges = {}
@commands.command("help", pass_context=True)
async def help(self, ctx: commands.Context):
@ -48,7 +48,8 @@ class Help(commands.Cog):
await ctx.message.add_reaction("\u2753")
elif isinstance(error, MissingRequiredArgument) or isinstance(error, BadArgument):
await ctx.message.add_reaction("\u274C")
elif isinstance(error, NotOwner) or isinstance(error, MissingPermissions):
elif isinstance(error, NotOwner) or isinstance(error, MissingPermissions)\
or isinstance(error, NoPrivateMessage):
await ctx.message.add_reaction("\u274C")
else:
await ctx.send("An error occurred !")

View file

@ -58,6 +58,7 @@ class Presentation(commands.Cog):
@commands.Cog.listener()
async def on_message(self, message: Message):
if message.guild is not None:
s = db.Session()
p = s.query(db.Presentation).filter(db.Presentation.guild == message.guild.id).first()
s.close()

View file

@ -41,6 +41,7 @@ class Purge(commands.Cog):
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: RawReactionActionEvent):
if payload.guild_id:
user = self.bot.get_user(payload.user_id)
message = await self.bot.get_guild(payload.guild_id).get_channel(payload.channel_id)\
.fetch_message(payload.message_id)