mIRC Home    About    Download    Register    News    Help

Print Thread
#247187 23/07/14 09:09 PM
Joined: Jul 2014
Posts: 4
N
n00ber Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Jul 2014
Posts: 4
I have a friend who has a Twitch channel and does a lot of giveaways with the !ticket raffle system his bot has. On the first of every month he gives his subscribers a 1000 points boost. The problem is he has to do this manually on the first of every month. Now that he has 600+ subs this gets very time consuming to copy and paste !points add 100 username. Is there a easy why to read the usernames from a txt files and have it auto write this into chat for him automatic? Or is there a better solution i am just not aware of?

Thanks in advance.

Joined: Dec 2013
Posts: 779
N
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Assuming this is for a bot, you want to trigger it from a remote text event:
Code:
on *:text:!givepointstoeveryone:#: {
var %file path\to\the\file.txt
var %lines $lines(%file)
while %lines {
var %user $read(%file,%lines)
;Here you add the points to the user. 
;It's probably something like "Points add %user 100" 
dec %lines
}
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Where does he get the names from at the moment?

Getting the subscribers from the API automatically involves quite a bit of setting up.

If there's an easier way that than to get them into a text file, then you can simply loop over every line of the text file and add their points.

Here are three posts about using subscribers:
https://forums.mirc.com/ubbthreads.php/topics/245691/Twitch_Subscriber-only_command
https://forums.mirc.com/ubbthreads.php/topics/244141/Welcoming_a_new_Subscriber
https://forums.mirc.com/ubbthreads.php/topics/244032/Twitch_Bot_Check_Subscription_

I would not use twithclient or twitchnotify to obtain your list because these do not provide a mechanism for removing users who are no longer subscribed.

To make sure this does not happen more than once per month I would suggest storing and comparing the last month and year the command was run.

Joined: Jul 2014
Posts: 4
N
n00ber Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Jul 2014
Posts: 4
Thanks for the reply. I don't think he can give a bot the permission required to do the points add command. but, If he can that looks like a pretty straight forward solution.

Joined: Jul 2014
Posts: 4
N
n00ber Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Jul 2014
Posts: 4
Originally Posted By: Loki12583
Where does he get the names from at the moment?
I think he gets the sub names from his twitch dashboard.

Getting the subscribers from the API automatically involves quite a bit of setting up.
I agree, getting the subs from an API will probably be a major pain.

If there's an easier way that than to get them into a text file, then you can simply loop over every line of the text file and add their points.
Is there a way to make a batch file? So, he can drag a txt file onto the batch and it types the required !points add command? and it uses his username/permissions?

Here are three posts about using subscribers:
https://forums.mirc.com/ubbthreads.php/topics/245691/Twitch_Subscriber-only_command
https://forums.mirc.com/ubbthreads.php/topics/244141/Welcoming_a_new_Subscriber
https://forums.mirc.com/ubbthreads.php/topics/244032/Twitch_Bot_Check_Subscription_

I would not use twithclient or twitchnotify to obtain your list because these do not provide a mechanism for removing users who are no longer subscribed.

To make sure this does not happen more than once per month I would suggest storing and comparing the last month and year the command was run.


Thanks for the reply.




Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
Originally Posted By: n00ber
Is there a way to make a batch file? So, he can drag a txt file onto the batch and it types the required !points add command? and it uses his username/permissions?


You wouldn't use a batch file, this is why mirc has a scripting language. Isn't he the one running the bot? Why wouldn't he have access to the add points command? Nillen already gave a script to loop over the names in the file, just use the /msg command to message the channel. With 600 lines this'll have to be spread out with a timer to avoid being kicked off the server.

Joined: Jul 2014
Posts: 4
N
n00ber Offline OP
Self-satisified door
OP Offline
Self-satisified door
N
Joined: Jul 2014
Posts: 4
Originally Posted By: Loki12583
Originally Posted By: n00ber
Is there a way to make a batch file? So, he can drag a txt file onto the batch and it types the required !points add command? and it uses his username/permissions?


You wouldn't use a batch file, this is why mirc has a scripting language. Isn't he the one running the bot? Why wouldn't he have access to the add points command? Nillen already gave a script to loop over the names in the file, just use the /msg command to message the channel. With 600 lines this'll have to be spread out with a timer to avoid being kicked off the server.


The bot is being hosted, his isp was shutting him down when the bot was hosted on his pc. They thought it was DDoS attacks when people did the !ticket command lol So he has to type a command in chat then the bot pushes the points. I am going to try and get with him tonight, and see if he can make the loop script work.

Thanks again for the help.


Link Copied to Clipboard