@@ -64,6 +64,10 @@ async def on_message(message):
64
64
await set_secondary (message , "region" )
65
65
return
66
66
67
+ if "set_cfn" in command .lower () or "set cfn" in command .lower () or "cfn" in command .lower ():
68
+ await set_secondary (message , "cfn" )
69
+ return
70
+
67
71
if "alias" in command .lower () or "games" in command .lower ():
68
72
await tell_aliases (message )
69
73
return
@@ -101,7 +105,7 @@ async def on_message(message):
101
105
return
102
106
103
107
async def addgame (game_to_add , message ):
104
- # FIXME see Github issue about this.
108
+ # FIXME see GitHub issue about this.
105
109
if message .author .permissions_in (message .channel ).kick_members :
106
110
add_game = "INSERT INTO games (game) VALUES ('" + game_to_add + "')"
107
111
await db_wrapper .execute (client , message .author , add_game , True )
@@ -142,25 +146,24 @@ async def describe(message):
142
146
user_description = discord_user + " is queued up for " + ", " .join (list_of_users_games ) + "\n "
143
147
else :
144
148
user_description = discord_user + " isn't queued up for any games.\n "
145
- user_description_query = "SELECT challonge, fightcade FROM users WHERE username='" + discord_user + "'"
149
+ user_description_query = "SELECT challonge, fightcade, cfn FROM users WHERE username='" + discord_user + "'"
146
150
user_description_result = await db_wrapper .execute (client , message .author , user_description_query , True )
147
151
if str (user_description_result ) == "()" :
148
152
await client .send_message (message .author , "I don't know anyone named " + discord_user + "." )
149
153
return
150
154
user_description_tuple = user_description_result [0 ]
151
- if user_description_tuple [0 ] is not None :
155
+ if user_description_tuple [0 ]:
152
156
user_description += "Their Challonge username is " + user_description_tuple [0 ] + "."
153
- else :
154
- user_description += "I don't know their Challonge username."
155
157
if user_description_tuple [1 ]:
156
158
user_description += " Their Fightcade username is " + user_description_tuple [1 ] + "."
157
- else :
158
- user_description += " I don't know their Fightcade username ."
159
+ if user_description_tuple [ 2 ] :
160
+ user_description += " Their CFN is " + user_description_tuple [ 2 ] + " ."
159
161
await client .send_message (message .author , user_description )
160
162
print (str (datetime .now ())+ ": gave " + discord_user + "'s description to " + message .author .name + "." )
161
163
return
162
164
163
- async def getPlayerInfoWithChallonge (message , tournament , challonge_id ):
165
+
166
+ async def getDiscordFightcadeUsingChallonge (message , tournament , challonge_id ):
164
167
# We have a Challonge ID and we need a Discord user and a Fightcade username.
165
168
# if we can't get that, we'll just print the Challonge username.
166
169
getDiscordFightcadeQuery = "SELECT discord_id, fightcade FROM users WHERE challonge_id = '" + str (challonge_id ) + "'"
@@ -278,12 +281,11 @@ async def pairing(message):
278
281
# Mod version of command. Ping everybody in the tournament with their pairing.
279
282
for tournament in tournaments :
280
283
discord_output += "\n Pairings for " + tournament ["game-name" ] + ": \n "
281
- match_params = {'state' :"open" }
282
- # FIXME only get current matches (i.e. Round 1 or whatever.)
284
+ match_params = {'state' :"pending" }
283
285
matches = challonge .matches .index (tournament ["id" ], ** match_params )
284
286
for match in matches :
285
- player1 = await getPlayerInfoWithChallonge (message , tournament , match ["player1-id" ])
286
- player2 = await getPlayerInfoWithChallonge (message , tournament , match ["player2-id" ])
287
+ player1 = await getDiscordFightcadeUsingChallonge (message , tournament , match ["player1-id" ])
288
+ player2 = await getDiscordFightcadeUsingChallonge (message , tournament , match ["player2-id" ])
287
289
discord_output += player1 + " vs. " + player2 + "\n "
288
290
else :
289
291
# TODO Regular version of command. Only ping the person who asked.
0 commit comments