Author Topic: Tricks with Deepbot Commands  (Read 31106 times)

0 Members and 1 Guest are viewing this topic.

Nazo

  • Padawan
  • **
  • Posts: 70
  • Karma: +2/-0
  • Expert on Twitch Bots
    • View Profile
  • Twitch Name: OverlordNazo
Tricks with Deepbot Commands
« on: December 19, 2015, 04:52:07 AM »
So, I've been experimenting with Deepbot variables recently, and I've decided to share some of my knowledge.

Updater Commands

Setup:
Code: [Select]
!setcommand !editcmd !command <text you want !setcommand to replace in !command>
Just replace "!setcommand" with a name that will be easy to remember and "!command" with the command being updated. You can also add @target@ in the new message when making the command. If you wanna make it more interesting, you can also add @target@[1], @target@[2], etc. (See example 2 below)

Example 1:

So, let's say I stream on the Xbox One and PlayStation 4, and I have a !console command that tells viewers which one I'm on, I can easily update my !console command by adding two more commands: !setxb1 and !setps4

This is what my !setxb1/!setps4 commands will look like:
Code: [Select]
!setxb1 -> !editcmd !console OverlordNazo is currently streaming on the Xbox One.

OR

!setps4 -> !editcmd !console OverlordNazo is currently streaming on the PlayStation 4.

When I use !setxb1 or !setps4, Deepbot will say that !console has been updated successfully.

After using !setxb1:
Code: [Select]
!console -> OverlordNazo is currently streaming on the Xbox One.
After using !setps4:
Code: [Select]
!console -> OverlordNazo is currently streaming on the PlayStation 4.
Example 2:

So, for example, I have a schedule that lists which days of the week I will be on the Xbox One and PlayStation 4. It currently looks like this:
Code: [Select]
!schedule -> Sunday: | Monday: | Tuesday: | Wednesday: | Thursday: | Friday: | Saturday:
I'll make a !setschedule command that looks like this:
Code: [Select]
!setschedule -> !editcmd !schedule Sunday: @target@[1] | Monday: @target@[2] | Tuesday: @target@[3] | Wednesday: @target@[4] | Thursday: @target@[5] | Friday: @target@[6] | Saturday: @target@[7]
Here's an example of what I'd type:
Code: [Select]
!setschedule Xbox N/A Xbox PS4 Xbox N/A N/A
Schedule will now display this every time it's triggered (until it's updated manually or by another command):
Code: [Select]
!schedule -> Sunday: Xbox | Monday: N/A | Tuesday: Xbox | Wednesday: PS4 | Thursday: Xbox | Friday: N/A | Saturday: N/A
Simplifying Commands

A certain broadcaster I mod for requires that everyone who votes for her and/or posts about her stream on social media receives 100 points. So, what I did was make it easier for mods to give points to viewers.

Setup:
Code: [Select]
!vp -> !add <number of points> @target@
So, since viewers get 100 points per vote, my setup will look like this when making the command:
Code: [Select]
!vp -> !add 100 @target@

Usage:
!vp <username>

Now all I have to do is type !vp and the username of the person who voted (or "all", to give 100 points to everyone). Here's what it would look like
Code: [Select]
!vp OverlordNazo
Result: Added 100 points to OverlordNazo

覧覧覧覧覧覧覧覧

I will add some more useful stuff soon, but if you have some of your own, post it here so I can add it to the list.
« Last Edit: October 17, 2016, 02:01:44 PM by Nazo »
★ Twitch Bot Expert ★


YouTube: Lord Nazo
Twitch: OverlordNazo
Twitter: @Lord_Nazo

RADRaze2KX

  • Youngling
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
  • Twitch Name: RADRaze2KX
Re: Tricks with Deepbot Commands
« Reply #1 on: February 12, 2016, 03:11:31 AM »
Nice, thanks for this

TheDefiant604

  • Youngling
  • *
  • Posts: 21
  • Karma: +0/-0
    • View Profile
  • Twitch Name: TheDefiant604
Re: Tricks with Deepbot Commands
« Reply #2 on: August 03, 2016, 07:24:49 PM »
Awesome!

We have a command to provide a pastebin of ESEA guest passes each day. There's some static text, followed by the current month and day, then the pastebin URL. So far, the other mods got the full text correct each time they updated it, but now we can just use a set-command!

Here's what I did, thanks to what I learned here:
Code: [Select]
!addcmd !setcodes %8 !editcmd !eseacodes ESEA Guest Passes for @datetime@[MMMM dd]: @target@[1]I know !editcmd can only be run by mods, so restricting !setcodes to mods by using %8 is a little redundant, but why take a chance?

Kudos given. :)
Chat Moderator for RandomRambo

SinNoAria

  • Youngling
  • *
  • Posts: 24
  • Karma: +0/-0
    • View Profile
    • SinNoAria YT
  • Twitch Name: SinNoAria
Re: Tricks with Deepbot Commands
« Reply #3 on: September 17, 2016, 09:54:38 AM »
While I didn't use this guide for my bot, I do have a couple of really absurd commands on my channel. I wanted to mention a few here (in simplified form) as they are similar to what is in the opening post. (essentially an expanded version).

I use triggered commands (Command Chaining) a lot and VIP variables a lot! While these commands don't necessarily need VIP variables, they make things much easier.



(Should be mod only, on my channel, VIP gold have access to this)
Code: [Select]
!AutoHost -> @if@[@target@[1]||On||!startautohost||@if@[@target@[1]||Off||!stopautohost|| ]]What this does is it checks if the word after the AutoHost is On or Off and activates a command depending on which one was chosen.

This is a form of command splitting, which is part of command chaining. (turning one command into multiple commands. The other commands are still available directly, but this command makes it so they only have to remember one command, not that important here, but for more complicated commands...)



!ChaoticAirs (This triggers another command. The importance of this command is less now, but before, this was the only way I knew how to chain without using custom JSON api, this has changed a bit, but I still keep it this way for this command).

This uses the Command Chaining Command: (I have this run as bot and admin access. One thing to note is that @counter@ here actually uses ChaoticRule's counter)
Code: [Select]
!ChaoticAirs -> text + Command Chaining Command: -> !ChaoticRule @counter@ @randomuser@OR ver2
Code: [Select]
!ChaoticAirs -> text + Command Chaining Command: -> !ChaoticRule
This command has actual flavor text, but that is not important here.

(This randomizes the value from the counter and then gives it to the randomuser selected earlier. It should be noted that in ver2 @randomuser@ and @counter@ are used here instead).
Code: [Select]
!ChaoticRule -> !add @rand@[1|@target@[1] ] @target@[2]OR ver2
Code: [Select]
!ChaoticRule -> !add @rand@[1|@counter@ ] @randomuser@
This was mainly to give an example of chaining commands, usually to add flavor text.



!Atropos (This has to be used with a value after)
Condensed version:
Code: [Select]
!Atropos -> @if@[>||@intpoints@||@target@||@editpoints@[@user@|-@target@[1] ] @exec@[1,!rebirtha @target@[1] ] @user@ spent @target@[1] Airs to give viewers Airs with the Atropos spell! || @user@ does not have enough Airs to cast Atropos!]
Now, this likely looks complicated. As this allows the user to specify the amount of points that they want to use, what it does is first checks if the user has enough points.

If the user has enough points, then it works to activate the commands, otherwise, it gives an error message. (The more complicated version would also do a check to see if the target value is high enough)

When activating the command, it first removes the points using editpoints (so the amount doesn't actually show up in chat) by using a -@target@, turning the target into a negative number (this technically can be circumvented, hence why the more complicated version checks that the target value is above a certain amount first, this code looks complicated enough without an extra nested @if@).

Code: [Select]
!rebirtha -> !add @rand@[1|@calc@[/|@target@|4] ] all


(VIP Gold only on my channel, super expensive) Lets my viewers vent a bit and unmod a mod (cooldown is super long so that only one person gets unmodded each day and they can be remodded later, but automating the remodding would be under advanced commands).
Code: [Select]
!unmod -> @if@[@target@[1]||<bot name>||Bot has resisted unmod||@sendstreamermsg@[/unmod @target@[1]] ]
This is a form of user selection (or in this case, deselection (I could've also refunded the points and potentially even undid the cooldown in this case)). With this, you can make it so that a command only gets sent if the person is who you want them to be (using @user@ instead of @target@, for example) You can use various function such as @lookupinfo@ and @readfile@ and depending on how you set things up, @userinfo3@.



(Cooldown is about 30 minutes and costs 44444 points on my channel, I don't use @streamermsg@ on my channel, but whether you have to or not may depend on settings.
Code: [Select]
!HostMe -> @sendstreamermsg@[/host @target@ @user@]

Similarly, you can enable turning on/off your stream with !startstream !stopstream (obs remote). You can give this function to a trusted editor through chaining and user selection!





Now I'll go into what I was going to show.

Code: [Select]
!LicenseUser -> !permit @target@ @user@
Simple enough. What it does is a fallback system. IF there is no target chosen, it falls back to the user that used this. This is useful for SINGLE target commands.

With all that said, a few things that I would've done with the opening post

Code: [Select]
!vp -> !pointadd @target@[1] @target@[2] 100
Code: [Select]
!pointadd -> !add @target@[2] @target@[1]
This would make it so that if you did !vp Streamer, it would add 100, but if you did !vp Streamer 200, it would add 200.

Another thing that could be done is that the amount added could be based on the user (if each user has a different value that they add).

Finally, a different way of approaching the console change

Code: [Select]
!console -> @if@[@user@||<Streamer>||@if@[@target@[1]||XB1||@savefile@[console.txt, <Streamer> is currently streaming on the Xbox One.]||@if@[@target@[1]||PS4||@savefile@[console.txt, <Streamer> is currently streaming on the PS4.]||@readfile@[console.txt]]||@readfile@[console.txt]]
Essentially, !console would display the current streaming system while !console PS4 would change the current system to PS4 and !console XB1 would change the current system to XB1.

There are other ways of doing this, including 'toggle' type commands, but we'd be talking about stuff that are way too complicated.