[Breaking] Changes for Budabot 4

Questions, comments, suggestions, and bug reports
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

[Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 1:27 pm

Budabot is a huge project, relatively speaking. It weighs in at ~34K lines of PHP code alone, in addition to the 117K lines of SQL (see: https://www.openhub.net/p/budabot2/anal ... es_summary). Because of its size, it makes development cumbersome. For those who have used Budabot for the past several years, you've might have noticed an emphasis on removing things, and that is in large part to keep the project manageable. As part of that process, I routinely change or remove things that break backwards compatibility. In great development projects, backwards compatibility is rarely, if ever, broken. In good ones, backwards compatibility is broken after a suitably lengthy deprecation process. Budabot is very poor in this regard, and this especially affects people who are writing and using custom modules. I would like to encourage as many people who want to produce and consume custom modules to do so, and I realize the problems that it causes when Budabot versions are not compatible. I try to minimize that where I can but in order to keep the project clean and manageable that is not often possible.

With that said, Budabot 4 will contain several changes, some of which break compatibility with previous versions. I will use this thread to document them so you can see the changes that will be coming. I have locked the thread to keep it clean, but feel free to make a new thread with comments, questions, and feedback if you have such on any of the items posted here.

These changes will apply to those who are producing and consume custom modules for Budabot. These changes won't affect those who run a 'vanilla' version of Budabot.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 1:40 pm

One of the ongoing changes for Budabot 4 is changing from snake-case (get_tower_info) to camel-case (getTowerInfo). These changes have been happening for the past few released of Budabot. All of the core modules and classes should now be using method names in camel-case. Budabot 4 will push this change to some if not all of the user modules.

So if you have a module that is failing on a method call, one of the first things you should check is if the method name has been renamed to camel-case.

This may cause some compatibility issues.

EDIT: This is now done for all user modules as well.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 1:46 pm

Budabot 4 uses the JSON representation of the PoRK data for both individual characters and org rosters, which includes several fields that the XML version does not. Specifically, character_id, head_id, and legacy pvp_title and pvp_rating fields. The legacy pvp rating system was deprecated quite a while ago, and it's not clear if the values that it returns are simply the last values each character had before the legacy pvp system was turned off, or it the values continue to be updated currently. I suspect it's the former.

!whois now includes the head_id, pvp_rating, and pvp_title fields in the "More Info" link.

This is unlikely to cause any compatibility issues.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 1:51 pm

There were several steps required to disable the bot from posting to or reading from the org channel. Now, that has been rectified. The org channel is completely controlled with one setting: !setting change guild_channel_status

With the org channel disabled, the bot will no longer send any messages to the org channel (unless a module bypasses the normal sendGuild method), and will no longer log org channel messages to the console.

This is unlikely to cause any compatibility issues.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 1:55 pm

I have added a new event type called 'packet'. You must specify the packet id for the packet that you want to listen to. The previous way this was done was to register an 'allpackets' event listener, and then filter the packets based on what you wanted. Now, you can specify the packets that you want to listen to in the event type. Here is an example of listening to packet id 20 (AOCP_CLIENT_NAME):

Code: Select all

   /**
    * @Event("packet(20)")
    * @Description("Records names and charIds")
    */
   public function recordCharIds($eventObj) {
      $packet = $eventObj->packet;
      if ($this->util->isValidSender($packet->args[0])) {
         $this->nameHistoryCache []= $packet->args;
      }
   }


In the future it may be possible to use the AOChat definitions for packet types, but currently you must use the id. Since this is new functionality, it likely will not cause any compatibility changes.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 1:57 pm

Meant to be used in conjunction with the previously added 'packet' event type, you can now specify multiple event types for one event handler method. In this example, we are listening to both AOCP_CLIENT_NAME and AOCP_CLIENT_LOOKUP packet types:

Code: Select all

   /**
    * @Event("packet(20)")
    * @Event("packet(21)")
    * @Description("Records names and charIds")
    */
   public function recordCharIds($eventObj) {
      $packet = $eventObj->packet;
      if ($this->util->isValidSender($packet->args[0])) {
         $this->nameHistoryCache []= $packet->args;
      }
   }


Since this is new functionality, it likely will not cause any compatibility changes.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 11, 2018 2:04 pm

I have removed several event types:

'allpackets' event type has been removed, since the 'packet' event type effectively replaces it.

'extjoinpriv' event type has been removed, as none of the built in modules were currently using it.

'extleavepriv' event type has been removed, as none of the built in modules were currently using it.

The external private channel events mimic the private channel events with the difference that they are for private channels other than the one that the bot owns. If you need either of the external private channel event types that were removed, you can use the 'packet' event type to get the same functionality, although you will need to parse the arguments yourself. You can see how this is done in /core/Budabot.class.php.

This may break compatibility, although most modules were probably not using these features.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Thu Jan 25, 2018 8:01 am

I have updated how timer events are declared. Previously, when you wanted to add a timer event, you would declare it by putting the 'budatime' value as the event type:

Code: Select all

@Event("24hrs")


Now, you specify it as "timer(budatime)". For instance:

Code: Select all

/**
 * @Event("timer(24hrs)")
 * @Description("Parses all orgs from People of Rubi Ka")
 */
public function parseAllOrgsEvent($eventObj) { ... }


This makes it a little cleaner to deal with, and a little cleaner to understand. Currently the old format still works, but eventually it will be going away. So you will want to upgrade your custom modules that use timer events in order to work with Budabot 4.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Wed Feb 07, 2018 2:55 am

I have made some changes to the RAID_MODULE:

1) Adding loot is now done with !loot add <item> instead of !loot <item>

2) Removing loot is now done with !loot rem <item_number> instead of !remloot <item_number>, although there is a default alias for the old command.

3) Adding multiloot is now done with !loot addmulti <number> <item> instead of !multiloot <number> <item>, although there is a default alias for the old command.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases
Tyrence
Posts: 2007
Joined: Sat Jan 09, 2010 1:32 am

Re: [Breaking] Changes for Budabot 4

Postby Tyrence » Wed Feb 07, 2018 3:02 am

As some of you know, I was evaluating a new format for !online based on a command written by Naturarum (see: viewtopic.php?f=4&t=1076).

After a fair amount of testing and mostly positive feedback, I have decided to move ahead with this. The main changes are:

1) I have removed !sm, but there is a default alias for it to !online.

2) I have removed the old !online command.

3) I have renamed !players to !online so the online list now groups characters by their main character.

Thew new format for !online is cleaner, in my opinion, and nearly everyone I talked to preferred it over the old version. However, the new version does not include players from the IRC channel. Also, there is no way to get the old format for !online. If either of these caveats apply to you, you are recommended to stay on Budabot 3.5. I would be interested to know if anyone opts to stay on Budabot 3.5 for either of those reasons.
"Those who expect to reap the blessings of freedom, must, like men, undergo the fatigues of supporting it." — Thomas Paine
"Nearly all men stand adversity, but if you want to test a man's character, give him power." — Abraham Lincoln
Budabot Releases and Downloads: https://github.com/Budabot/Budabot/releases

Return to “General”

Who is online

Users browsing this forum: No registered users and 1 guest