adam-saudagar avatar

Supbot API | Whatsapp Group Chatbot API | Developement update #3

adam-saudagar

Published: 11 Oct 2018 › Updated: 11 Oct 2018Supbot API | Whatsapp Group Chatbot API | Developement update #3

Supbot API | Whatsapp Group Chatbot API | Developement update #3

supbot banner

While working with Supbot API to make tutorials, I realized that, ConsoleCommand was very tedious to work with and the design for Schedule and ScheduleTask was very confusing. So before I make the tutorial with such bad design I had to change things and add new features to make it more friendly.

Repository

https://github.com/adsau59/supbot
Commit1
Commit2

What is Supbot API?

Supbot API is a Whatsapp Group Chatbot API, Showcase video.

Whatsapp is the most used messenger platform, but the lack of bot support made it very tedious to perform some operations that other platform with bot support performs easily.

Supbot API uses Selenium to automate Whatsapp Web to read and collect data, runs business logic and perform different actions defined by the developer, it provides various features to developers to create their own features and add it inside Whatsapp itself.

Objective

  • To create bot support on the most used messenger platform out there.
  • To create a way for developers to make their own features inside whatsapp itself.
  • To teach developers how to use Supbot API using video tutorials.

Technology Stack

Supbot is made using

New Features

Created HelpCC Console Command

Why?

  • Working with Console Commands was very tedious, as when the developer wants to use a command, they had to look up its usage in the documentation.
  • A way was needed to check which commands are available and their usage during runtime.

How?

  • In the ConsoleCommand abstract class, an abstract getHelper() method was created which returned a Helper object which contained 3 Strings, template, example, description.
  • When help console command is used with a target console command, the getHelper() of the target console command is used to generate a message which is printed in the console.

Schedule and ScheduleTask rework

Why?

  • Schedule and ScheduleTask was very confusing to work with, as by the previous design a detaTime was given to reschedule the task, but when the task was missed, it had to be rescheduled manually by code by the developer, hence two different ways to do same thing added a lot of confusion.
  • A simpler method was required to reschedule the tasks so that developing schedule task is much more friendly.

How?

  • In Schedule, reScheduleDeltaTime variable was removed completely and the method which used it, nextSchedule() was also removed.
  • ScheduleTask was changed from abstract class to interface, as there was no need for it to be an abstract class.
  • Created ScheduleCC Console Command, which includes commands to create, delete, show schedules which made working with schedule much more friendly.
  • Removed ScheduleCreateCC and ScheduleDBDeleteCC, as they did the same things as ScheduleCC.

Created ReScheduler

Why?

  • While making a ScheduleTask, developer is required to define nextSchedule() method which uses the previous schedule date in string format and have to return a date in string format for the next schedule.
  • Implementing such method is tedious as it includes a lot of verbose, hence a helper methods for such task will make it much more friendly.

How?

  • Two most used methods for re scheduling, viz. AfterDaysSameTime and AfterSecondsFromNow was created as a static method inside ReScheduler class.
  • These methods can be used inside nextSchedule() method in ScheduleTask to return the date directly from these methods.
  • AfterDaysSameTime reschedules on the same time as before, but after specified days, it is used to reschedule daily, weekly, monthly, yearly tasks.
  • AfterSecondsFromNow reschedules seconds after current time, it is used for tasks which run every x secs, minutes, hours.

Roadmap

Development for Supbot API has finished, but as developers are using the API, they request new features or some bad design in the bot is noticed, I will try my best to add/change it in the bot.

How to contribute?

You can contribute this project by,

  • Using the the API and creating issue when any bug is encountered.
  • Helping me in the development by bug squashing or developing new features. (If you want to do this, contact me so that we can collaborate.)
  • Let me know if you have any good feature ideas.

Contact

If you have any problems or you want to contact me for feature ideas or want to collaborate in development you can contact me on DefineX Community discord server

GitHub Account

https://github.com/adsau59

Leave Supbot API | Whatsapp Group Chatbot API | Developement update #3 to:

Written by

Game Developer, Gamer, Otaku :D

Read more #utopian-io posts


Best Posts From adam-saudagar

We have not curated any of adam-saudagar's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From adam-saudagar