logo bannerlogo banner

migration quicknotes

Warning

this is for yolkbot 2.0, which is in open beta. visit the old documentation to learn about the current release version of yolkbot.

some quick things to know while migrating:

you'll need to uninstall the current packages

to do this on desktop, run:

npm uninstall yolkbot
# or
pnpm uninstall yolkbot
# or
bun rm yolkbot

depending on which package manager you use

installing yolkbot is different

desktop -> you no longer just install yolkbot from npm. you can learn about the new commands here

browser -> you can no longer use the old CDN links. you can learn about the new links here

the imports have been "squashed"

instead of importing in multiple lines from yolkbot/something, you now just import from yolkbot. this means that this:

import { Bot } from 'yolkbot/bot';
import { ChatDispatch } from 'yolkbot/dispatches/ChatDispatch';
import { SpawnDispatch } from 'yolkbot/dispatches/SpawnDispatch';

can simply be turned into this:

import { Bot, ChatDispatch, SpawnDispatch } from 'yolkbot';

some "polyfills" don't exist anymore

previously, if you hadn't yet logged in, things like bot.account and bot.game were empty objects with placeholder values. these both now just don't exist until you log in and join a game, respectively.

bot.me also warns you if you try to access it before it has been created, because it no longer has polyfill data.

a lot of stuff has moved around

quite a bit has moved around. your best bet for finding things is trying to look for syntax errors, and then crossreferencing on docs.yolkbot.xyz

the most significant changes involved accounts. things that previously existed on bot (such as playChiknWinner) has been moved to bot.account and its respective subclasses (so it would be bot.account.cw.play). another example is bot.buyItem is now bot.account.shop.buy. this was designed to help migrate things to classes to make things more organized!

not too much has changed on the game side, but a few things previously on bot have moved to bot.game that only pertain to games (like bot.ping -> bot.game.ping, bot.pathing -> bot.game.pathing, bot.canSee -> bot.game.canSee, etc)

some aliases have been made (bot.me points to bot.game.me, bot.players points to bot.game.players, etc) to make things easier to migrate, but these are just aliases and not the actual data, so they throw errors if you use them before joining a game.

types significantly changed

Note

this is only applicable if you write in typescript and not javascript

since yolkbot is now internally typescript, types are a lot more comprehensive. two of the biggest changes are that bot.account and bot.game are marked as optional fields. this is in fact a little annoying but helps to better conform to typescript itself.

pathfinding got much better

i'm taking pathfinding feedback in my DMs (@kuddleyourkitty). some stuff is still in the works, which will have postings sent in #annc in the community.


that's all for now! ask questions and get migration help until the end of may over in the community.