Skip to content

Commit

Permalink
split message and submission channel
Browse files Browse the repository at this point in the history
  • Loading branch information
96-LB committed Dec 19, 2020
1 parent 121e916 commit 62e6fa4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cogs/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Messages(commands.Cog):

def __init__(self, bot):
self.bot = bot
self.channel = self.bot.get_channel(int(os.getenv('MSG_CHANNEL')))

def find_team(self, user):
return load_cog(self.bot, 'Teams').find_team(user)
Expand All @@ -28,10 +29,9 @@ async def ask(self, ctx, *, msg=None):
elif not msg:
await ctx.send('You must supply a message to send to the organizers!')
else:
channel = self.bot.get_channel(int(os.getenv('CHANNEL')))
team_name = team['NAME']
team_id = team['ID']
await channel.send(f'💬 **Message from {ctx.author.mention} of team `{team_name}` (Team ID: `{team_id}`)**\n**' + '\~' * 31 + f'**\n{msg}', allowed_mentions=AllowedMentions(everyone=False, users=[ctx.author], roles=False))
await self.channel.send(f'💬 **Message from {ctx.author.mention} of team `{team_name}` (Team ID: `{team_id}`)**\n**' + '\~' * 31 + f'**\n{msg}', allowed_mentions=AllowedMentions(everyone=False, users=[ctx.author], roles=False))
await ctx.send(f'Message successfully delivered! The organizers will get back to you soon.')

@organizer_channel()
Expand Down
2 changes: 1 addition & 1 deletion cogs/novice.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Novice(commands.Cog):

def __init__(self, bot):
self.bot = bot
self.channel = self.bot.get_channel(int(os.getenv('CHANNEL')))
self.channel = self.bot.get_channel(int(os.getenv('NOV_CHANNEL')))
self.problems = 26
self.tests = 10
self.submissions = data.get('SUBMISSIONS')
Expand Down
2 changes: 1 addition & 1 deletion core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def new_id():

def organizer_channel():
async def check(ctx):
return str(ctx.channel.id) == os.getenv('CHANNEL')
return str(ctx.channel.id) in (os.getenv('NOV_CHANNEL'), os.getenv('MSG_CHANNEL'))
return discord.ext.commands.check(check)

def load_cog(bot, cog_name):
Expand Down

0 comments on commit 62e6fa4

Please sign in to comment.