Discord Bot

Robot avatar images lovingly delivered by Robohash.org.

tao  •  12 Oct 2021   •    
Screenshot

There have been rumblings today. Some people have had their Twitter accounts banned and closed and people suspect that the reason is that they are being tracked back to engagement groups.

When you copy and paste your Twitter post link, Twitter adds a “cookie” tracking parameter to the end.

These are two examples:

I have read before that when posting to an engagement group, to remove the parameters from the URL so Twitter can’t track where you are coming from. Too many direct hits to the URL might trigger a flag that shows you are using an engagement group or tactics which are against the Twitter TOS.

I guess this might also cause a strike against the accounts posting or clicking the link. I am not sure which one it causes issues for.

I know that Discord allows bots, so I followed a quick tutorial, learned some Python on the fly and using replit.com knocked up a bot that watches for messages posted with ?s= or ?t= in, removes the parameters from the end and reposts the URL again.

Of course, it only works on my test Discord server and still needs lots of work, but it was an interesting hour learning to get it going. In an ideal world, it would either pop up a message telling the poster to change the link, or it would automatically edit the link for you after it was posted. This is preferable to the bot just reposting the link itself as you end up with double the messages.

I also managed to get itself caught in a loop too where it was constantly replying to messages it had already posted. I need to work on the logic a bit more as I need it to only work on messages with twitter.com in the URL too.

I have never looked into creating Discord bots before now and have no real idea how they are hosted. I assume I would need to host it somewhere and then people can get an invite to add it to their Discord server.

I don’t really understand it at all.

Another string to my bow though, perhaps?

Comments

Wow cool! What did you code it in? PHP? Is the replit repo public? Would love to take a look at the code!

jasonleow  •  13 Oct 2021, 2:15 am

Its in Python, which I have never used before.
You can see it here - but it doesn’t work properly at the moment.
The code is pretty simple - check for a ?s= or ?t= in the message and then split the string into an array on the ? character and output element 0.

Robot avatar images lovingly delivered by Robohash.org.
tao  •  13 Oct 2021, 7:33 am

Wow python. I’d never used it before either… but sounds like can be done using regex or plain javascript

jasonleow  •  14 Oct 2021, 1:19 am

Yeah, it would have been more simple to use a language I knew, but it is fun to learn something new.
I suppose you would just need to load in the relevant Discord libraries to get it to work.
Anyways, I have dropped the project now :)

Robot avatar images lovingly delivered by Robohash.org.
tao  •  14 Oct 2021, 8:27 am

I’d always wanted to create a Telegram bot. Everyone seems to use Python for it. Have you seen a Telegram bit built on Javascript?

jasonleow  •  15 Oct 2021, 12:42 am

No, but I have never delved into Telegram bots either.

Robot avatar images lovingly delivered by Robohash.org.
tao  •  15 Oct 2021, 8:31 am

Discover more

Sourced from other writers across Lifelog

Ooops we couldn't find any related post...