예제 #1
0
파일: Player.py 프로젝트: TomD53/PUG-Bot
 def add_player(cls, minecraft_id, discord_id, priority=0, elo=1000):
     minecraft_username = MojangAPI.get_username(minecraft_id)
     if minecraft_username:
         if check_players_minecraft_id(minecraft_id):
             raise UsernameAlreadyExistsError()
         elif check_players_discord_id(discord_id):
             raise DiscordAlreadyExistsError()
         add_player(minecraft_id, discord_id, minecraft_username, priority,
                    elo)
         return cls(
             (minecraft_id, discord_id, minecraft_username, priority, elo))
     else:
         raise UsernameDoesNotExistError()
예제 #2
0
    def test_get_username(self):
        username = MojangAPI.get_username(self.NOTCH_UUID)
        self.assertEqual(username, self.NOTCH_USERNAME)

        username = MojangAPI.get_username(self.INVALID_UUID)
        self.assertEqual(username, None)
예제 #3
0
    elif username_or_uuid == 'uuid':
        uuid_input = input('Enter uuid: ')
        profile_skin_uuid = MojangAPI.get_profile(uuid_input)
        print('The skin url is: ', profile_skin_uuid.skin_url)

if selection == '1':
    username_input = input('Enter your current minecraft username: '******'There uuid is: ' + uuid)

if selection == '2':
    uuid_input_2 = input('Enter the uuid: ')
    username = MojangAPI.get_username(uuid_input_2)
    print('The username is ' + username)

if selection == '4':
    username_or_uuid_cape = input(
        "Type 'user' to use username to find skin, or type uuid to find skin with your uuid"
    )
    if username_or_uuid_cape == 'user':
        username_input_cape = input("Enter your username: ")
        uuid_get_cape = MojangAPI.get_uuid(username_input_cape)
        profile_cape = MojangAPI.get_profile(uuid_get_cape)
        print('The skin url is: ', profile_cape.cape_url)
    if username_or_uuid_cape == 'uuid':
        uuid_input_cape = input('Enter the uuid: ')
        profile_cape = MojangAPI.get_profile(uuid_input_cape)
        print('The skin url is: ', profile_cape.cape_url)
예제 #4
0
파일: Player.py 프로젝트: TomD53/PUG-Bot
 def update_minecraft_username(self):
     self.minecraft_username = MojangAPI.get_username(self.minecraft_id)
     update_players_minecraft_username(self.minecraft_username,
                                       self.minecraft_id)
     return self.minecraft_username