From 3b38c5293e80b81e1c7d413b51525136c4d58c02 Mon Sep 17 00:00:00 2001 From: Neuro Assassin <42872277+NeuroAssassin@users.noreply.github.com> Date: Tue, 6 Oct 2020 10:56:50 -0400 Subject: [PATCH] [Fix] Prevent error if a TOT channel is deleted (#165) * Add fix for if a TOT channel is deleted * version Co-authored-by: aikaterna <20862007+aikaterna@users.noreply.github.com> --- trickortreat/trickortreat.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/trickortreat/trickortreat.py b/trickortreat/trickortreat.py index 182e156..656698e 100644 --- a/trickortreat/trickortreat.py +++ b/trickortreat/trickortreat.py @@ -9,7 +9,7 @@ from redbot.core import commands, checks, Config, bank from redbot.core.utils.chat_formatting import box, pagify, humanize_number from redbot.core.utils.menus import menu, DEFAULT_CONTROLS -__version__ = "0.1.2" +__version__ = "0.1.3" class TrickOrTreat(commands.Cog): @@ -447,7 +447,8 @@ class TrickOrTreat(commands.Cog): channel_msg = "Trick or Treat Channels:\n" for chan in channel_list: channel_obj = self.bot.get_channel(chan) - channel_msg += f"{channel_obj.name}\n" + if channel_obj: + channel_msg += f"{channel_obj.name}\n" await ctx.send(box(channel_msg)) @commands.guild_only()