Chatango Bot inner guide part 1

Hello there fellow chatango bot developers !

It's been a while since my first starter tutorial on "How to make chatango bot with python", a topic which may lead (or not) some people to grow their desire to develop their own ideas on developing a chatango bot. In this section, I'm going to show some methods and basic ideas on exploring some of many functions the chatango library (in this case I use ch.py) and ExampleBot.py script to make use for them at their best in order to increase the basic features for our bot. I'm sorry for the late and lack of actions to share the knowledge on this matter, but I do believe there are still many newcomers who are yet to understand the basic use of ch.py themselves, so I'm going to share it anyway.
In this tutorial, I'll divide the explanations of each things by parts for the sake of efficiency for those who would ask some questions regarding the topic and I will also share some command variations example, so you would look forward to it eagerly by reading this article carefully. So then, Let's begin.

the first would be "class TestBot". This class is the Main class of our bot, and inside it you will find many functions and event callbacks. The first thing I want you guys to check out is the "onInit" event of our TestBot class. In this matter, onInit is the initialisation of our TestBot class which is done on script execute.

Inside onInit we can see these things:
    self.setNameColor("FF9966")
    self.setFontColor("33CCFF")
    self.setFontFace("1")
    self.setFontSize(12)
    self.enableBg() 
    self.enableRecording()

I think most of you already know what that code above does, but I will still explain them in a phrase that I understands. The "self" in the codes above are declaring that they are the property of our TestBot class and not other classes,
example: "self.user.getFontColor" ← This variable is used for getting the bot's FontColor value
and the value of self.user.getFontColor can be determinded using this function:
self.setFontColor("ff0000")
in which is done at the initialisation (onInit event), further explanation of each is below.

self.setNameColor ← used to determine the bot's name color. You don't use "red" or "blue" argument for color name, instead use bit color code (ex: "111111" for white or "cc0000" for red). usage → (ex: self.setFontColor("cc0000") )

self.setFontColor  ← is used for changing the bot's font color, using color bit code as.argument (like self.setNameColor does). Usage → (ex: self.setFontColor("ffxc00") )

self.setFontFace ← used for changing your bot's font face/type, you may be able to use number from "1" to "7" (include the "" ) as string argument (ex: self.setFontFace("5") ), or use the font name instead (ex: use "arial" font type → self.setFontFace("arial") )

self.setFontSize ← Used for determining the bot's font size. For bot account with no premium feature, the max font size is 13. usage is → (ex: self.setFontSize(13) )

self.enableBg  ← this function is used for enabling thr bot's background, which is only available for bot account with chatango premium. if you want to enable background for your bot, you can donate to chatango (please give messedhat some bg too, 1 or 2 dollars won't hurt :D ) unless your bot's account have premium, the bg will never appear. to use self.enableBg you can just call the function itself (ex: self.enableBg() ) and to disable bg (ex: self.disableBg() ) and vice versa

self.enableRecording ← this function is to enable your bot's recording feature (which is also a premium feature). usage is → (ex: self.enableRecording()   to disable - self.disableRecording() )


These font formatting functions can also be implemented to a command, and I'll guide you through it.

I assume you already know how to implement a command inside onMessage event callback (if you don't know, you can post a comment, and I'll help you whenever I'm online).

On the lines just below the onMessage, you can see commands such as:

if cmd == "say":
  if args:
    room.message(args)
  else:
    room.message("What to say.?")


and many more more commands.
You can make a new command in that line section (just remember to put your commands on the lines after the bot prefix declaration)

so the new command would be "format"
codes are in the link below.

Format Command Code

Done! the "format" command is just there for anyone to use.
Well then, the first part is finished. Look forward to the upcoming guide regarding onConnect and onDisconnect event callbacks along with many of it's greatest use.
If you ever have any questions regarding the topic in this post, please do comment, or pm me via chatango (0rx / Xmothra), When I'm online, I will help in any way I can

Good luck and Cheers!

0rX

Comments

  1. Good post and a fantastic read. You have raised some valid points. Great work, keep it up. I love returning back to this site and reading the quality content you always have on offer.If you are hopeless while picking the right subject and don't have the foggiest thought where to discover it, don't delay to buy custom essay on the web. Visit custom essay writing service and pick an essential kind of educational paper and grade. Complete brisk and basic enlistment and get your faultless paper by the due date.

    ReplyDelete

Post a Comment

Popular Posts