Nothing exactly like that, which I can think of. You can take any script for the handling of commands, like, look at this post:
Very simple script that runs one command. Be sure to change the command names and the script name in
$.registerChatCommand(). You can also change the ‘1’ on that to a ‘7’ for all viewers to be able to run.
Now, the guts will be different. You will be using:
$.setIniDbString('battletag', sender, args); to set the tag and
$.getIniDbString('battletag', sender, 'Not provided'); to get the tag back.
The first parameter to those calls is the table name, the second is the key. On the
set function, the third argument is what to set the value to. On the
get function, the third argument is what to return if a key is not found in the DB.
Now, what you will probably want to do is either have two commands like !setbtag and !btag or work with parameters on !btag to have !btag set [id] and !btag [user] (if someone on Twitch is named ‘set’, oh well). Or, and I don’t know a lot about Battletags, but, if all battle tags have a hashtag (#) in them, then I suppose you could write logic to say if the argument contains a ‘#’ then set a value, else, try to retrieve one.
You can check to make sure the user provides a parameter with
if (args === undefined) to catch and return a usage to the user.
To submit to PhantomBots GitHub, if possible, check out the $.lang.register() functions, so that the settings are not hard-coded into a script. However, there is nothing wrong with posting to the forums using hard-coded outputs.