11import json
2+ import os
23import sys
34from typing import Optional , Union
45
@@ -187,18 +188,26 @@ async def channel_info(self, ctx: commands.Context, *, channel: GlobalTextChanne
187188 description = "ID: `{0.id}`\n Guild: {0.guild.name} (`{0.guild.id}`)\n Category: {0.category}\n "
188189 "Slowmode: {0.slowmode_delay}\n NSFW: {1}\n Created at: {2}\n "
189190 "[Permissions Value]({3}): {4}" .format (
190- channel , nsfw , ago , "google .com" , str (perms )),
191+ channel , nsfw , ago , f"https://discordapi .com/permissions.html# { perms } " , str (perms )),
191192 color = channel .guild .owner .color ,
192193 timestamp = channel .created_at
193194 )
194195 return await ctx .send (embed = e )
195196
196197 async def cog_command_error (self , ctx , error ):
198+ if os .getenv ("RG_EH" ):
199+ try :
200+ rg = int (os .getenv ("RG_EH" ))
201+ except :
202+ print ("Assuming you want logging since the env var \" RG_EH\" isn't an integer of 1 or 0." )
203+ else :
204+ if rg < 1 : return
197205 error = getattr (error , "original" , error )
198206 if isinstance (error , commands .BadArgument ):
199207 return await ctx .send (f"Argument conversion error (an invalid argument was passed): `{ error } `" )
200208 elif isinstance (error , commands .MissingRequiredArgument ):
201209 return await ctx .send (str (error ))
202210 print (f"Exception raised in command { ctx .command } :" , error , error .__traceback__ , file = sys .stderr )
211+ print ("You can turn these warnings off by setting the environment variable \" RG_EH\" to 0" )
203212 return await ctx .send (f"\N{cross mark} an error was raised, and printed to console. If the issue persists,"
204- f" please open an issue on github (<https://github.com/dragdev-studios/RiftGun/issues/new>)" )
213+ f" please open an issue on github (<https://github.com/dragdev-studios/RiftGun/issues/new>)" )
0 commit comments