Telegram Bot API, an adaptation for Roblox [BETA]

This version is deprecating soon. A new, optimized and more complete, version will be launched on the future.


Hello everyone.

A few days ago I started working on a game, in which I was asked to make a system so that moderators can kick players out of the game. But with the peculiarity that administrators (or other rank higher than moderators) can monitor the reason why moderators are kicking players.
I created another completely different version, with another service, and thanks to the Post Approval team I realized that I could create something that did not exist in Roblox. An adaptation of the Telegram Bots API.

For those who do not know what Telegram is, it is a messaging application like any other, but with pecualiarities such as for example that it is not necessary to have the number of another person to be able to talk to it, you can contact them through user names, or the super peculiarity that I have used, the Bots.
Telegram Bots are “accounts” like that of a user. The only difference is that the Bot is programmed, and has no life :cry:


With this adaptation of the API, you can do the following things (for the moment):

To configure the module, and that the messages can be sent, you must indicate the Token of your bot (then I will show you how to get it) and the chatId of where you want the messages to be sent. Remember that this helps moderation, so if you have a group on Telegram with the administrators of your game, etc. You can put the group chatId. (Inside the module I explain how to get the chatId, but I will do it here anyway)

local telegram = require(4757888945)
-- The token of a bot is similar to this:
local botToken = "1111111111:XXXXXXXXXXXXXXXXX-XXXXXXXXXX"
-- The chatId is similar to this:
local chatId = "40XXXXX69"

telegram.configure(botToken, chatId)

If you inserted all the data well, everything should work perfectly. Otherwise, an error will notify you that you were wrong.
…
As this module is dedicated to moderation (and to moderation of moderation :joy:), the option of kicking a player could not be lacking, sending administrators the following information:

  • Name of the player who was kicked
  • Reason why it was kicked.
  • And the most important, who kicked the player.

To send this message you must do it as follows:

telegram.kickSendingMessage(player, moderator, reason)

The module is ready to kick with or without moderator, and with or without reason. I mean the data that cannot be missing is the player, obviously if you do not indicate the player you could not kick it :man_shrugging:
…
To send a message, to the chatId specified in the configuration, you can do the following:

telegram.sendAlert(alert, moderator)
-- What this will send is something similar to the following:
"Message: " .. alert .. ". Sent by: " .. moderator

…
Also, one of my favorite functions, I must say, is that you can send a Token to a user as a verification method, etc.
To do this, follow the steps below:

telegram.sendToken(chatId)
-- In this case you will have to replace "chatId" with the chatId 
-- of the user to whom you want the Token sent.

…
You can also send a message / alert to a group. Remember that to send a message to a user, you must use “sendAlert”

telegram.sendMessageToGroup(group, message)

Those are all functions at the moment. If I see that the module has an impact and is used, I will be working on better updates.


Bot Screenshots:

telegram.kickSendingMessage(player, moderator, reason) :
Captura de pantalla (223)
(ignore “testing” messages :slight_smile:)
…

telegram.sendToken(chatId)
Captura de pantalla (224)
…

telegram.sendAlert(message, moderator)
Captura de pantalla (225)
…

telegram.sendMessageToGroup(group, message)
Captura de pantalla (226)


Telegram tutorials:

Create a Bot:

  • Send a message to @BotFather on Telegram and follow the steps. :slight_smile:

Get the Bot Token:
When creating the Bot, the BotFather should indicate the Token. But you can also do the following.

  • Send “/mybots” to BotFather
  • Choose the Bot you are using.
  • Click “API Token”
  • That’s all!

Get a chatId:

  • Send a message to @myidbot on Telegram!

I really appreciate the feedback. So if you have any suggestions or something to tell me you can contact me through my social networks, which you can find both in my Roblox profile and here in the DevForum.

I usually respond more quickly on Twitter, but you can also contact me by Discord, PM on Roblox, or even here at DevForum.


If you want you can join the unofficial group of the Roblox Developers community on Telegram that I created.
Search for “robloxdevelopers” in the “search” section of Telegram.


I hope I helped you with this API adaptation that I made.

Thanks for reading!
Regards, nanitook.


(©2020 nanitook, GNU GPLv3)
I am not responsible for the use that another user may give it.

23 Likes

Um the model is not for sale, You maybe want to fix it really quick.

4 Likes

My mistake, sorry. It should be on sale now.

1 Like

This is really cool, I now want to try it!

3 Likes

Your testing place is currently private, so if you can fix this I can test it out

That people actually make ROBLOX-Telegram APIs is quite impressive.