add channel check

This commit is contained in:
Amazed 2020-09-28 04:10:13 +02:00
parent 7d14139a28
commit f547fcc107

View File

@ -4,6 +4,8 @@ from redbot.core import Config, checks
import discord import discord
import re import re
LISTENING_CHANNEL = 620879085739966464
class SacrificeCog(commands.Cog): class SacrificeCog(commands.Cog):
def __init__(self, bot): def __init__(self, bot):
@ -36,7 +38,7 @@ class SacrificeCog(commands.Cog):
await self.log(tracked.keys()) await self.log(tracked.keys())
if str(payload.message_id) in tracked.keys(): if str(payload.message_id) in tracked.keys():
# fetch channel # fetch channel
channel = await self.bot.fetch_channel(620879085739966464) # channel channel = await self.bot.fetch_channel(LISTENING_CHANNEL) # channel
if not channel: if not channel:
tracked.remove(payload.message_id) tracked.remove(payload.message_id)
await self.config.tracked_msgs.set(tracked) await self.config.tracked_msgs.set(tracked)
@ -85,6 +87,8 @@ class SacrificeCog(commands.Cog):
@commands.command() @commands.command()
async def rank(self, ctx, opponent: discord.Member = None, winloss: str = None): async def rank(self, ctx, opponent: discord.Member = None, winloss: str = None):
if ctx.channel.id != LISTENING_CHANNEL:
return
author_id = str(ctx.author.id) author_id = str(ctx.author.id)
if not opponent and not winloss: if not opponent and not winloss:
# send elo to player # send elo to player