• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

EN Kind of DeleteMsg();

jasiubor

Member
Hi guys, I'm searching for functions that can:
- Delete messages,
- Check channels description
- Delete channel descriptions
- Event like - on.link.click + get.link.name + cancel.link.opening

Thanks :)

(btw. I'm doing script that delete channel description when the IP logger link is in description)
 
Last edited:

cakemasher

Well-Known Member
Contributor
Assuming you mean deleting server messages, this is not possible as far I know. Getting and setting channel descriptions is able through the API of the Sinusbot (see API-docs).

What do you mean exacly with the events you're asking for? Do you mean that those events should be fired when a client clicks on a link within a channel description? In that case, it's not posible.
 

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
- Delete messages,
You can't delete messages in teamspeak. This would only be possible for discord.
- Check channels description
- Delete channel descriptions
Already possible:
https://sinusbot.github.io/scripting-docs/#channeldescription
https://sinusbot.github.io/scripting-docs/#channelsetdescription
- Event like - on.link.click + get.link.name + cancel.link.opening
Definitely not possible.

(basically what @cakemasher said)
 

jasiubor

Member
I'd like to replace every link in description to the [ url=example.com ] *typed link here* [ / url]

The idea is to re-connect from every link in description to our TS3's site to avoid IP Loggers etc.
 
Last edited:

irgendwr

no longer active, "retired" staff member
is awesome!
V.I.P.
is uber awesome!
Contributor
Insider
I'd like to replace every link in description to the [ url=example.com ] *typed link here* [ / url]
Then do it, nobody is stopping you.

Iterate over every channel, get the description, match it against a regex rule, replace if it matches.
 

jasiubor

Member
Yeah everything okay but I don't know how to do this, so I came up here to get help about it because I couldn't find help on google
 

Tuetchen

Diesmon Dominator
is awesome!
Contributor
Insider
channel.setDescription(channel.getDescription().replace(*yourRegex*, *yourNewLink*));

Just insert some regex to detect the old link and it will replace it and save it. Do that for every Channel you want to update.
 

jasiubor

Member
channel.setDescription(channel.getDescription().replace(*yourRegex*, *yourNewLink*));

Just insert some regex to detect the old link and it will replace it and save it. Do that for every Channel you want to update.
Thank you so much!
Can you tell me how to save the *your Regex* into a variable ? I need it in the next steps of script.

Also, do this in "*" or in "apostrofes" ?
 

cakemasher

Well-Known Member
Contributor
Regex'es are quite difficult to learn (I'm not rly into them either..). You could take a look on this website that explains what regex'es are.

How are the links formatted that you're trying to convert to [url...?
 

jasiubor

Member
Look:
all the links are automatically edited to this: [ url ] https://example.com [ / url]
I wanna to save the link for example in var1,
then I wanna to replace whole link to [ url = espeak24.eu/link/var1 ] var1 [/ url]
 

cakemasher

Well-Known Member
Contributor
Try something like this:

JavaScript:
    var channelDesc = 'Hey! Have you ever seen [url]https://sinusbot.com[/url]? It\'s great!';
    var linkName = 'This is a link';
   
    channelDesc = channelDesc.replace (/\[url\](.[^\]]+?)\[\/url\]/ig, "[url=$1]" + linkName + "[/url] ");

(Haven't deeply tested it, but seems to be working)
 

cakemasher

Well-Known Member
Contributor
Thank you, but what does it exactly do ?

Is it regex ?
It is.
Code:
// Start of regex
/

// Part of text the string should contain where \ are escaping chars.
\[url\]

// Magic part. Not entirely sure what happens here honestly, but this will grab the contents between [url] and [/url].
(.[^\]]+?)

// Part of text the string should contain where \ are again, escaping chars.
\[\/url\]

// End of regex, where the 'i' makes the search case-insensitive and 'g' makes a global search through the entire string.
/ig
 
Top