Fix private messages
This commit is contained in:
parent
8fda6e37bb
commit
14f2ab7e3f
3 changed files with 22 additions and 19 deletions
|
@ -1,6 +1,7 @@
|
||||||
from discord import Embed
|
from discord import Embed
|
||||||
from discord.ext import commands
|
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 import config
|
||||||
from administrator.logger import logger
|
from administrator.logger import logger
|
||||||
|
@ -14,7 +15,6 @@ logger = logger.getChild(extension_name)
|
||||||
class Help(commands.Cog):
|
class Help(commands.Cog):
|
||||||
def __init__(self, bot: commands.Bot):
|
def __init__(self, bot: commands.Bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.purges = {}
|
|
||||||
|
|
||||||
@commands.command("help", pass_context=True)
|
@commands.command("help", pass_context=True)
|
||||||
async def help(self, ctx: commands.Context):
|
async def help(self, ctx: commands.Context):
|
||||||
|
@ -48,7 +48,8 @@ class Help(commands.Cog):
|
||||||
await ctx.message.add_reaction("\u2753")
|
await ctx.message.add_reaction("\u2753")
|
||||||
elif isinstance(error, MissingRequiredArgument) or isinstance(error, BadArgument):
|
elif isinstance(error, MissingRequiredArgument) or isinstance(error, BadArgument):
|
||||||
await ctx.message.add_reaction("\u274C")
|
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")
|
await ctx.message.add_reaction("\u274C")
|
||||||
else:
|
else:
|
||||||
await ctx.send("An error occurred !")
|
await ctx.send("An error occurred !")
|
||||||
|
|
|
@ -58,6 +58,7 @@ class Presentation(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_message(self, message: Message):
|
async def on_message(self, message: Message):
|
||||||
|
if message.guild is not None:
|
||||||
s = db.Session()
|
s = db.Session()
|
||||||
p = s.query(db.Presentation).filter(db.Presentation.guild == message.guild.id).first()
|
p = s.query(db.Presentation).filter(db.Presentation.guild == message.guild.id).first()
|
||||||
s.close()
|
s.close()
|
||||||
|
|
|
@ -41,6 +41,7 @@ class Purge(commands.Cog):
|
||||||
|
|
||||||
@commands.Cog.listener()
|
@commands.Cog.listener()
|
||||||
async def on_raw_reaction_add(self, payload: RawReactionActionEvent):
|
async def on_raw_reaction_add(self, payload: RawReactionActionEvent):
|
||||||
|
if payload.guild_id:
|
||||||
user = self.bot.get_user(payload.user_id)
|
user = self.bot.get_user(payload.user_id)
|
||||||
message = await self.bot.get_guild(payload.guild_id).get_channel(payload.channel_id)\
|
message = await self.bot.get_guild(payload.guild_id).get_channel(payload.channel_id)\
|
||||||
.fetch_message(payload.message_id)
|
.fetch_message(payload.message_id)
|
||||||
|
|
Reference in a new issue