async def on_message(message): # we do not want the bot to reply to itself if message.author == client.user: return main_guild = client.get_channel(config.welcome_channel).guild messenger = message.author temp_msg = [] # Code here if game.game_going_on() == False: # Check if the user hasn't signed up yet if game.is_playing(messenger.id,config.signees_file): if is_command(message,['start']): await message.channel.send("We're gonna start the game in 15 seconds! Get ready!") await asyncio.sleep(15.0) await message.channel.send("Starting game! *cough cough* TODO") else: if is_command(message,['join','signup']): if check.modes(message) == False: save(import_data().append()) await asyncio.sleep(5) for msg in temp_msg: await msg.delete()
def set(user_id, position, value, csv_file=data_file): old_table = import_data(csv_file) for user in old_table: if int(user[0]) == int(user_id): user[position] = value save(old_table, csv_file) return True raise NameError("User not found in database!")
def is_playing(user_id, csv_file=data_file): for participant in import_data(csv_file): if str(participant[0]) == str(user_id): return True return False
def game_going_on(csv_file=data_file): if import_data(csv_file) == []: return False return True
def amount_of_players(csv_file=data_file): return len(import_data(csv_file))