Utils
Scaffolds provide utility functions that can be used to perform common tasks when programming a bot.
update_is_for_me
python
def update_is_for_me(update: RelevantGameUpdate, my_id: PlayerID, my_small_id: PlayerSmallID) -> booljava
public static boolean updateIsForMe(
@NotNull Object update,
@NotNull String myId,
@NotNull int mySmallId
)Determines whether a given RelevantGameUpdate is relevant to your bot using your bot's PlayerID and PlayerSmallID.
Updates that originate from your bot (e.g. alliance requests sent by your bot, messages sent by your bot) are not considered relevant.
The function considers an update to be relevant if:
- It is an
AllianceRequestUpdatewhere the recipient is your bot (someone asked you for an alliance). - It is an
AllianceRequestReplyUpdatewhere the requester is your bot (you asked someone for an alliance and they replied). - It is a
BrokeAllianceUpdateand your bot was the one betrayed (someone broke their alliance with you). - It is an
AllianceExpiredUpdateand your bot was one of the parties in the expired alliance (an alliance you were in has expired). - It is an
EmojiUpdateand the recipient is either your bot (someone sent you an emoji) or everyone (someone sent an emoji to everyone, including you). - It is a
DisplayChatMessageUpdateand the recipient is your bot (someone sent you a chat message).
