AnkhHeart / Streamlabs-Chatbot-Python-Boilerplate

75 stars 21 forks source link

Wiki Editing? #2

Open goldantgaming opened 5 years ago

goldantgaming commented 5 years ago

It looks like there is no way for us to submit pull requests for the Wiki at the moment. Is it possible to open the wiki up for suggested edits or to edits?

Specifically I wanted to point out on this page that the UI file must be named UI_Config.json otherwise it will not work, just wanting to save someone else time and trouble. https://github.com/AnkhHeart/Streamlabs-Chatbot-Python-Boilerplate/wiki/Creating-UI-Config-File

The other thing I'm trying to figure out at the moment is how to access the UI values once they've been set in the UI. I suspect the Parent object has a way to access them, but my normal method of logging the vars() of an object to see what is inside is failing on the Parent object.

Thanks! :)

mithom commented 5 years ago

also there are some faults in the wiki, like wrong return types, or typos that could easily be fixed by people who read it.

@goldantgaming you need to do settings management yourself, there are 3 function for you to do this: 1) Init(): read out the file in which you saved the settings, if this fails, set default values (best equal to the default values in the UI_config.json) EDIT: this function gets called at startup before anything else, also after renewing. 2) Unload(): this is where you save your game, normally you also save your settings in here, but you can save them also in the Init (or both) if you like. EDIT: this function gets called when you close chatbot or before renewing 3) ReloadSettings(jsondata): This function gets called when you press the save button on your settings panel, this is also the only place where you ever get values back from the settings, update your settings in your script and best save them at once in here.

an example of how to do this can be found in the code, or almost any script you download from the discord

Killerbear commented 5 years ago

another change for the wiki would be the Checking Permissions page.

it should list all possible options:

and a more common example like

if data.IsChatMessage() and Parent.HasPermission(data.User,"Everyone","")
  Parent.SendStreamMessage('This bot replies to everyone')
rialDave commented 5 years ago

Something that helped me a lot for debugging is an explanation how to get all variables / methods from objects, put out in your Chatbot Logging Screen (i-icon). Maybe makes sense to add this somewhere in the Wiki, but at least could help you guys out in the future.

Example for getting information about the "Parent" object:

# for debugging purposes: log available methods from Parent object
for method_name in dir(Parent):
    Parent.Log(ScriptName, method_name)
LateNightIceCream commented 3 years ago

It should also be mentioned that for currency manipulation the UserName Argument in e.g.

bool RemovePoints(string userid, string username, long amount)
Parent.RemovePoints(data.User,data.UserName,100)

has to be in lowercase

PatchaIT commented 1 year ago

another change for the wiki would be the Checking Permissions page.

it should list all possible options:

  • Everyone
  • Regular
  • Subscriber
  • GameWisp Subscriber
  • Moderator
  • Editor
  • Invisible
  • User_Specific (info:username)
  • Min_Rank (info:rank)
  • Min_Points (info:points)
  • Min_Hours (info:hours)

and a more common example like

if data.IsChatMessage() and Parent.HasPermission(data.User,"Everyone","")
  Parent.SendStreamMessage('This bot replies to everyone')

There's also "VIP Exclusive" permission level for Twitch VIPs actually, but it's not documented anywhere. Or at least, I didn't find it.