Esempio n. 1
0
 async def start(self, ctx):
     if not isinstance(ctx.channel, discord.channel.DMChannel):
         game = ctx.message.content.split(" ")[1]
         games = GameList.instance.get_games()
         open_games = GameList.instance.get_open_games() 
         if game in open_games:
             game_IDs = GameList.get_all_IDs(game)
             playing_IDs = ameList.get_playing_IDs()
             for ID in game_IDs:
                 if ID in playing_IDs:
                     await ctx.send("{} is already playing a game!".format(ctx.message.guild.get_member(ID)))
                     return 
             creatorID = GameList.instance.get_creator(game)
             if ctx.author.id == creatorID:
                 GameList.instance.start_game(game)
                 await ctx.send("{} has been started!!".format(game))
                 await self.run(game, ctx)
             else:
                 await ctx.send("{} does not have permission to start {}!".format(ctx.author, game))
         if game in games:
             await ctx.send("{} has already started!".format(game))
         else:
             await ctx.send("{} does not exist!".format(game))
     else:
         await ctx.send("Please join a server to use this command.")