File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,16 @@ def recaptcha(token):
6464def invite ():
6565 print ("Generating new invite!" )
6666 resp = requests .post (
67- 'https://discordapp.com/api/channels/%s /invites' % config ["discord" ]["welcome_room" ],
68- headers = {'Authorization' : 'Bot %s' % config ["discord" ]["private" ]},
69- json = {'max_uses' : 1 , 'unique' : True , 'expires ' : 300 }
67+ 'https://discordapp.com/api/channels/{} /invites' . format ( config ["discord" ]["welcome_room" ]) ,
68+ headers = {'Authorization' : 'Bot {}' . format ( config ["discord" ]["private" ]) },
69+ json = {'max_uses' : 1 , 'unique' : True , 'max_age ' : 300 }
7070 )
7171 i = resp .json ()
72- print ("Generated new invite!" )
72+ # error handling for invite creation
73+ if (i .get ('code' )):
74+ print ("Generated new invite!" )
75+ else :
76+ print (i )
7377 return i ["code" ]
7478
7579app = Flask (__name__ )
You can’t perform that action at this time.
0 commit comments