Need help with twitter retweet rewards


Enabled twitter module, it is linked to my account and post on my twitter frequently. Whenever i tweet it notifies my viewers in discord and twitch chat, and viewers are able to register their twitter with the bot. however, there are no notifications when people retweet and the bot is not giving rewards. any idea?


Have you followed this guide?


yup, thats why im stuck. not sure why it isnt giving rewards


i don’t quite understand the polling options. i have them all set to the default 60. is that how often the bot checks for new tweets and posts them? And how long does it take for users to be rewarded points?
i posted a tweet and users retweeted it and their points did not increase


I personally don’t use this system so I really only understand so much.

Based off the code, there are 4 (?) poll delays you can set. Each has a minimum value. I’ll just take this bit directly from the code:

 * @commandpath twitter set polldelay mentions [seconds] - Poll delay for mentions in seconds. Minimum is 60.
 * @commandpath twitter set polldelay retweets [seconds] - Poll delay for retweets in seconds. Minimum is 60.
 * @commandpath twitter set polldelay hometimeline [seconds] - Poll delay for home timeline in seconds. Minimum is 60.
 * @commandpath twitter set polldelay usertimeline [seconds] - Poll delay for user timeline in seconds. Minimum is 15.

Now I don’t see where this is utilized in the script, so I can only assume it’s handled in the core jar file (Which I’d have to do more digging in).

But, I do see an event handler for twitter retweets; which (again) I assume is triggered by the core when it’s polled.

Based off this information, I’d say a user should get their points around 60 seconds after a retweet. Assuming all conditions are met.

Another condition of the rewards, is that you define how long they must wait until getting another reward. this value is in hours.

There are only two things I see in the retweet event that “prevent” it from firing:

  1. You don’t have the module enabled.
  2. You don’t have the reward value set to above 0.

Now, as for checking if everything is working… I (personally) would edit the retweet event to add some debug statements, just simple $.consoleLn(''); messages that basically tell me “hey, the bot processed up to here”

If you wish to try to debug as I would.Turn your bot off, make a backup of your database and the twitter handler (these are precautions). Open /scripts/handlers/twitterHandler.js and replace the entirety of the retweet event with:

	 * @event twitterRetweet
	$.bind('twitterRetweet', function(event) {
		$.consoleLn('Retweet event started.');
		if (!$.bot.isModuleEnabled('./handlers/twitterHandler.js')) {
		$.consoleLn('Module is enabled');
		/* The core only generates this event if reward_toggle is enabled, therefore, we do not check the toggle here. */
		if ($.getIniDbNumber('twitter', 'reward_points') == 0) {
		$.consoleLn('Reward value not equal to 0.');

		var userNameArray = event.getUserNameArray(),
			rewardNameArray = [],
			reward = $.getIniDbNumber('twitter', 'reward_points'),
			cooldown = $.getIniDbFloat('twitter', 'reward_cooldown') * 3.6e6,
			now = $.systemTime();

		for (i in userNameArray) {
			twitterUserName = userNameArray[i].toLowerCase();
			userName = $.inidb.GetKeyByValue('twitter_mapping', '', twitterUserName);
			if (userName === null) {
			$.consoleLn('User: ' + userName + ' retweeted for a reward!');

			lastRetweet = $.getIniDbNumber('twitter_user_last_retweet', userName, 0);
			if (now - lastRetweet > cooldown) {
				$.inidb.incr('points', userName, reward);
				$.setIniDbNumber('twitter_user_last_retweet', userName, now);

		if (rewardNameArray.length > 0 && $.getIniDbBoolean('twitter', 'reward_announce')) {
			$.say($.lang.get('twitter.reward.announcement', rewardNameArray.join(', '), $.getPointsString(reward)));
		$.consoleLn('Retweet event finished.');

Then you will have to start a stream as normal and wait for users to retweet (or use a dummy account and retweet yourself but idk how twitter feels about that). At that point you should get messages in your console when the event is fired. I’d like to see a copy of those messages.

The bot developers will have better insight and better solutions than myself, if you wish to wait for them.


the bot is enabled and points have been set. i made a tweet which phantombot then linked in discord and twitch. a viewer who had registered his account with the bot retweeted the message and phantombot posted the message again with the tag [RT] showing it registered a retweet. however, no points were awarded :frowning:


Make sure that the user did not add the @ to his username when registering. That could be the issue here.


i am pretty certain he did. ill have him unregister and retry


Did you happen to use the debug code I posted?

It’d have posted lines in the bot’s console, and it’d have printed exactly which names are being rewarded (if any).

That way we could see if it was the @ issue. You could also check the database with a SQLite editor.


sorry for the delay, was at work. when a viewer tried to register without the @ the bot didn’t even register it. will try to debug tonight


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.