Update images in channel description

Brooke

Member
May 4, 2016
77
16
43
Hello,

I have a Teamspeak3 Server and I use images but they are updating themselfs some times a day. Thats working good but on Teamspeak the Picture wont update even If i paste the link new in the channel description.

Is it possible somehow that Teamspeak updates it?

Kind Regards
Brooke
 

Wrath X

Member
Oct 2, 2015
96
34
53
You can do this with PHP, like AdminsBot or BannerBot ( GitHub TS-ISLAM repository : https://github.com/warningman/TS-ISLAM ) same method.
  • AdminsBot changing channel description.
  • BannerBot is updating host banner.
If you show that images and say update frequency, I can try to make a bot for you. Btw you need a machine, TeamSpeak 3 Server is not enough.

Note: These links are always unique ? *

* Edit reason: Note added.
 
Last edited:

Brooke

Member
May 4, 2016
77
16
43
Its always the same link to the picture. Would be nice if you can help me out.
 

DifferentUser

Member
Feb 19, 2016
53
23
58
I dont know if you have tried this option and i am not sure if it actually works but try to add a "#1" behind the file and increase the number everytime you want to have it updated
 

Brooke

Member
May 4, 2016
77
16
43
I dont know if you have tried this option and i am not sure if it actually works but try to add a "#1" behind the file and increase the number everytime you want to have it updated
Thats actually working but I dont want to update it myself everytime.
 

Wrath X

Member
Oct 2, 2015
96
34
53
Hello m8, it is done. You need to edit 'config.php' first. After that you can start 'editChannel.php'.

VirusTotal 0/55
Download MEGA

Source Codes: Thanks @DifferentUser for the advise.
editChannel.php
PHP:
<?php
require_once("libraries/TeamSpeak3/TeamSpeak3.php");
require_once("config.php");
$ts3_VirtualServer = TeamSpeak3::factory("serverquery://$username:$pass@$ip:$queryPort/?server_port=$port&nickname=$botNick");
$img = '[/IMG]';
$counter = $timer / 300;
$i = 1;
$mychannel = $ts3_VirtualServer->channelGetById("$channelId");
while(1)
{
    while( $counter != 0 )
    {
        $mychannel["channel_description"] = "[IMG]$imageLink#$i$img";
        $counter = $counter - 1;
        sleep(300);
    }
    $i = $i + 1;
    $counter = $timer / 300;
}
?>
config.php
PHP:
<?php
$username='serveradmin'; //Your ServerQuery username (default: serveradmin)
$pass='xxxxx'; // Your ServerQuery password
$ip='127.0.0.1'; // Your server IP adress.
$queryPort='10011'; // Your server ServerQuery Port (default: 10011)
$port='9987'; // Your server port (default: 9987)
$botNick='ChannelBot'; // Your Bot's name
$channelId='100'; // The ID of the channel to be edited.
$imageLink='http://i.imgur.com/8BfM5AJ.jpg'; // Just image link
$timer=18000; // Update timer in seconds.
?>
TeamSpeak 3 PHP Framework
Source Link GitHub

Edit Reason: Files and virustotal scan updated. 10 mins timeout problem solved.
 
Last edited:

Brooke

Member
May 4, 2016
77
16
43
Thanks alot for your work but I get
Code:
PHP Parse error:  syntax error, unexpected end of file in /var/www/ts3bot/editChannel.php on line 9
If i type "php editChannel.php"
 

Wrath X

Member
Oct 2, 2015
96
34
53
Thanks alot for your work but I get
Code:
PHP Parse error:  syntax error, unexpected end of file in /var/www/ts3bot/editChannel.php on line 9
If i type "php editChannel.php"
Sorry mb, '}' is missing. I upload files again and editChannel.php code edited on post.
 

Brooke

Member
May 4, 2016
77
16
43
Code:
PHP Fatal error:  Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'nickname is already in use' in /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php:319
Stack trace:
#0 /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php(91): TeamSpeak3_Adapter_ServerQuery_Reply->fetchError(Object(TeamSpeak3_Helper_String))
#1 /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery.php(141): TeamSpeak3_Adapter_ServerQuery_Reply->__construct(Array, 'clientupdate cl...', Object(TeamSpeak3_Node_Host), true)
#2 /var/www/ts3bot/libraries/TeamSpeak3/Node/Abstract.php(73): TeamSpeak3_Adapter_ServerQuery->request('clientupdate cl...', true)
#3 /var/www/ts3bot/libraries/TeamSpeak3/Node/Abstract.php(97): TeamSpeak3_Node_Abstract->request('clientupdate cl...')
#4 /var/www/ts3bot/libraries/TeamSpeak3/Node/Host.php(189): TeamSpeak3_Node_Abstract->execute('clientupdate', Array)
#5 /var/www/ts3bot/libraries/TeamSpeak3/Node/Host.php(271): TeamSpeak3_Node_Host->serverSelectByPort(9987)
#6 /var/www/ts3b in /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php on line 319

Am I doing something wrong? Sorry for all the issues.
 

DifferentUser

Member
Feb 19, 2016
53
23
58
Uhm may i ask you how it works?

You dont even update the Link with this Script?
Or the Channel itself?

What you do is write every x Seconds the same String in a Variable (not in the Channel) without Exception Handling when the bot disconnects due the 10 Min Timeout which TeamSpeak has
 

Wrath X

Member
Oct 2, 2015
96
34
53
Code:
PHP Fatal error:  Uncaught exception 'TeamSpeak3_Adapter_ServerQuery_Exception' with message 'nickname is already in use' in /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php:319
Stack trace:
#0 /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php(91): TeamSpeak3_Adapter_ServerQuery_Reply->fetchError(Object(TeamSpeak3_Helper_String))
#1 /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery.php(141): TeamSpeak3_Adapter_ServerQuery_Reply->__construct(Array, 'clientupdate cl...', Object(TeamSpeak3_Node_Host), true)
#2 /var/www/ts3bot/libraries/TeamSpeak3/Node/Abstract.php(73): TeamSpeak3_Adapter_ServerQuery->request('clientupdate cl...', true)
#3 /var/www/ts3bot/libraries/TeamSpeak3/Node/Abstract.php(97): TeamSpeak3_Node_Abstract->request('clientupdate cl...')
#4 /var/www/ts3bot/libraries/TeamSpeak3/Node/Host.php(189): TeamSpeak3_Node_Abstract->execute('clientupdate', Array)
#5 /var/www/ts3bot/libraries/TeamSpeak3/Node/Host.php(271): TeamSpeak3_Node_Host->serverSelectByPort(9987)
#6 /var/www/ts3b in /var/www/ts3bot/libraries/TeamSpeak3/Adapter/ServerQuery/Reply.php on line 319

Am I doing something wrong? Sorry for all the issues.
Change the Bot's nickname. Did you change something on editChannel.php ? And don't forget the ' ' on config.php. I tested it 2 times it works for me...
 

Wrath X

Member
Oct 2, 2015
96
34
53
For example:
Use it like this ->
PHP:
$username='serveradmin'; //Your ServerQuery username (default: serveradmin)
$pass='xxxxxxxxx'; // Your ServerQuery password
$ip='127.0.0.1'; // Your server IP adress.
$queryPort='10011'; // Your server ServerQuery Port (default: 10011)
Not like this ->
PHP:
$username=serveradmin; //Your ServerQuery username (default: serveradmin)
$pass='xxxxxxxxx'; // Your ServerQuery password
$ip=your.ts3.domain.name; // Your server IP adress.
$queryPort=10011; // Your server ServerQuery Port (default: 10011)
 

DifferentUser

Member
Feb 19, 2016
53
23
58
Uhm may i ask you how it works?

You dont even update the Link with this Script?
Or the Channel itself?

What you do is write every x Seconds the same String in a Variable (not in the Channel) without Exception Handling when the bot disconnects due the 10 Min Timeout which TeamSpeak has

I am really interested in how it works since you only write every X Minutes a String into a Array Variable without any Updates of the Link or Updates the actual TeamSpeak Channel
 

Wrath X

Member
Oct 2, 2015
96
34
53
I am really interested in how it works since you only write every X Minutes a String into a Array Variable without any Updates of the Link or Updates the actual TeamSpeak Channel
I asked @Brooke:
These links are always unique ?
And @Brooke said:
Its always the same link to the picture.
So we don't need to change this string ? Link always same, but image is changing. I don't know HOW.
Did I understand you correctly?
 

Wrath X

Member
Oct 2, 2015
96
34
53

Wrath X

Member
Oct 2, 2015
96
34
53
Thats the Problem TeamSpeak Caches the Images by the Images URL
But @Brooke said "Thats actually working but I dont want to update it myself everytime.".
@Brooke didn't change image link I think. But okey I will edit code like you said.

Second problem is, Bot drops after 10 minutes, I will create a sh for bot start and bot stop and a crontab rule.

It is my first bot, thank you for your review.
 
Top