team rejection when trying to accept from a code

#1
I'm trying to implement a pokemon-showdown bot in Java and in the past couple days for some reason it doesn't auto accept challenges like I coded it to do
I have this function:
Java:
private void updatechallenges(String msg) {
        String [] args = msg.split(separator);
        String username = args[2].split("\"")[3];
        if(!username.equals("challengeTo")) {
            send("|/accept " + username);
        }
which activate when I get a challenge query from the server
in the form of:
|updatechallenges|{"challengesFrom":{"eyalmazuz":"gen7ou"},"challengeTo":null}
but then I get an error message with the following content
|popup|Your team was rejected for the following reasons:||||- You sent invalid team data. If you're not using a custom client, please report this as a bug.
but when I trying regularly from the browser to accept challenges with the same team (which is the only team the user have) it accepts the game
also if I send a random battle challenge the code also accepts the challenge without any problems

the full client code can be viewed here:
https://github.com/eyalmazuz/Pokemo...c/main/java/com/bgu/bp/connection/Client.java

it's really frustrating cause I can't make any progress until I fix this bug :(
 

Quite Quiet

sleep life away
is a Tournament Directoris a member of the Site Staffis a Super Moderatoris a Community Contributoris a Tiering Contributoris a Contributor to Smogonis a Smogon Media Contributoris a Battle Server Moderator
Articles Co-Leader
#2
I've not gone through your code closely, but do you send the /trn to select the team before accepting the challenge (it doesn't look like you do at glance)? And is the /trn in the right format?
 
#3
I've not gone through your code closely, but do you send the /trn to select the team before accepting the challenge (it doesn't look like you do at glance)? And is the /trn in the right format?
yes I send /trn in the login function with occur immediately after I get the challstr from the server

Java:
            //aseertion or check if the connection was successful
            System.out.println(obj);
            Object assertion = obj.get("assertion");
            send("|/trn "+uname+",0,"+assertion);
            conn.disconnect();
        }
        catch(IOException ioe)
        {
            ioe.printStackTrace();
        }
        loggedIn = true;
    }
I don't choose a team when getting a challenge because I only have 1 team on the bot and before the error occurred he was selecting automatically that team
 

Quite Quiet

sleep life away
is a Tournament Directoris a member of the Site Staffis a Super Moderatoris a Community Contributoris a Tiering Contributoris a Contributor to Smogonis a Smogon Media Contributoris a Battle Server Moderator
Articles Co-Leader
#4
Sorry, I mixed up the commands. My original question should've been about /utm not /trn. As far as I'm aware you have to send this at least once per login session.
 
#7
/utm is really simply, it basically updates what team you currently have selected (server side).

https://github.com/Zarel/Pokemon-Showdown/blob/master/chat-commands.js#L3919

It expects a packed string team (see: https://github.com/Zarel/Pokemon-Showdown/blob/master/sim/dex.js#L1107 for packing and https://github.com/Zarel/Pokemon-Showdown/blob/master/sim/dex.js#L1212 for unpacking teams)
for some reason the bug was fixed by himself
but now the bug returned and I again can't do UO battles cause of team rejection
I tried using /utm in the global chat but I didn't understand what I'm giving him
do I give the team name as in "Untitled 1" or the String of the team as in:
Tapu Koko @ Choice Specs
Ability: Electric Surge
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
IVs: 0 Atk
- Volt Switch
- Dazzling Gleam
- Hidden Power [Fire]
- Thunderbolt

Kyurem-Black @ Icium Z
Ability: Teravolt
EVs: 252 Atk / 4 SpA / 252 Spe
Hasty Nature
- Freeze Shock
- Fusion Bolt
- Hidden Power [Fire]
- Ice Beam

Latios @ Choice Scarf
Ability: Levitate
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
IVs: 0 Atk
- Draco Meteor
- Psyshock
- Defog
- Thunder Wave

Venusaur-Mega (M) @ Venusaurite
Ability: Chlorophyll
EVs: 248 HP / 164 Def / 96 SpD
Sassy Nature
- Giga Drain
- Sludge Bomb
- Earthquake
- Synthesis

Landorus-Therian @ Leftovers
Ability: Intimidate
EVs: 248 HP / 216 Def / 4 SpA / 40 Spe
Impish Nature
- Stealth Rock
- Earthquake
- Hidden Power [Ice]
- Protect

Magearna @ Assault Vest
Ability: Soul-Heart
EVs: 248 HP / 8 Def / 252 SpD
Sassy Nature
IVs: 16 Spe
- Fleur Cannon
- Iron Head
- Hidden Power [Fire]
- Volt Switch
also do I suppose to get a response back from the server after I use the command?
 

HoeenHero

The Misspelled Hero!
is a Battle Server Administratoris a Community Leaderis a Programmer
Community Leader
#8
Thats not a packed team string, thats a teambuilder format specifically made for the teambuilder and human readability.
This is a packed team string:
JavaScript:
"|tapukoko|choicespecs||voltswitch,dazzlinggleam,hiddenpowerfire,thunderbolt|Timid|,,,252,4,252||,0,,,,|||]|kyuremblack|iciumz||freezeshock,fusionbolt,hiddenpowerfire,icebeam|Hasty|,252,,4,,252||,30,,30,,30|||]|latios|choicescarf||dracometeor,psyshock,defog,thunderwave|Timid|,,,252,4,252||,0,,,,|||]|venusaurmega|venusaurite|chlorophyll|gigadrain,sludgebomb,earthquake,synthesis|Sassy|248,,164,,96,|M||||]|landorustherian|leftovers||stealthrock,earthquake,hiddenpowerice,protect|Impish|248,,216,4,,40||,30,30,,,|||]|magearna|assaultvest||fleurcannon,ironhead,hiddenpowerfire,voltswitch|Sassy|248,,8,,252,||,,,,,16|||"
(Please note the ""'s are to mark a string and technically arent part of the packed team (ex: dont escape them and include them)
Specifically its the team you posted above.
Server will not provide a response after your team is updated server side, but it should not fail.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top