• Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Supported Minecraft Versions
  1. 1.12
  2. 1.13
  3. 1.14
  4. 1.15
  5. 1.16
  6. 1.17
  7. 1.18
  8. 1.19
TeleLink
A helper skript to manage Minecraft players and their linked Telegram Accounts.


upload_2023-5-6_23-11-0.png

TeleLink account linking in Minecraft

upload_2023-5-6_23-23-56.png

TeleLink account linking in Telegram

upload_2023-5-6_23-24-46.png

Custom bot behaviour, on a separate Skript, but on the same telegram bot.

DEPENDENCIES
- Spigot/Paper 1.12.2+
- Skelegram addon

- Skript 2.6.2+


With this Skript, and with Skelegram, you'll create a new telegram bot that will interact with users. You'll be able to customize every aspect of the Skript, and even get functions to create your own!
/telelink | telelink.use | main command
/telelink link | telelink.use | begin linking your account.
/telelink unlink | telelink.use | unlink your account.
/telelink forceunlink | telelink.admin | forcefully unlink a player's account.
/telelink stop | telelink.admin | stop the bot
/telelink start | telelink.admin | start the bot
/telelink reset | telelink.admin | reset all the variables and linked users.
/telelink 2fa | telelink.2fa | Verify yourself via your telegram account. After verification is complete, the function is2FAAuthorized(p: offlineplayer) returns true, for a set amount of time (session duration, in options).
/telelink view | telelink.view | view another user's linked telegram account.

You may use the following functions to automatically get a player's TG account on the server. This is useful to quickly build a bot without having to register every user, as this already does the work you.

getLinkedMinecraft(id: text) | Get the linked minecraft account of a telegram ID of a user. The ID has to be a text, as Skript can't handle long numbers (and IDs are really long numbers)
getBotUser() | Get the username of the bot that is running TeleLink. TeleLink can only run 1 bot at a time, but a server may be running multiple different bots, so in order to send messages on commands or outside of telegram events you need to specify a bot name.
getTelegramID(p: offlineplayer) | Get the unique Telegram ID of a player, if they have linked an account. Otherwise null.
getTelegramUsername(p: offlineplayer) | Get the username of a player. Use this just for aesthetics, DON't RELY ON THIS! It may be null or could even not correspond to the player's updated username, as they can change it. USE getTelegramID instead!!
is2FAAuthorized(p: offlineplayer) | Use this function to check if a player has recently verified themselves with TeleLink's 2FA. Use this along with an else condition telling the player to verify themselves with /telelink 2fa, so they know how they can verify.

Code:
Options:
    id: -1001921980391 #A channel / group in which all the actions from this skript will be logged.
 
 
on chat:
    set {_message} to message
    set {_sender} to event-player
    send telegram message " %{_sender}%: %unformatted {_message}%" to {@id} with bot getBotUser()
 
 
on death of player:
    if attacker is set:
        send telegram message "⚔️ %victim% has been killed by %attacker%" to {@id} with bot getBotUser()
        if getTelegramID(victim) is set:
            send telegram message "⚔️ You've been killed by %attacker%!" to getTelegramID(victim) with bot getBotUser()
 

on join:
    if getTelegramID(player) is set:
        set {_message} to a new telegram message with text " You joined the game. Date: %now%"
        set {_button} to a new inline button with text "❌ KICK ❌" with callback data "kick"
        set {_keyboard} to a new inline keyboard with button {_button}
        set inline keyboard of {_message} to {_keyboard}
        send telegram message {_message} to getTelegramID(player) with bot getBotUser()
 
on callback query with data "kick":
    if "%event-telegram bot%" is getBotUser():
        set {_id} to "%id of event-telegram user%"
        if getLinkedMinecraft({_id}) is set:
            set {_p} to getLinkedMinecraft({_id})
            kick {_p}
            set {_text} to text of event-telegram message
            set {_text} to "%{_text}%%nl%%nl%✅ You kicked this user."
            set {_newmessage} to a new telegram message with text {_text}
            edit telegram message event-telegram message to {_newmessage} with bot getBotUser()
 
on join:
    send telegram message "➕ %player% joined the game." to {@id} with bot getBotUser()

on quit:
    send telegram message "➖ %player% left the game." to {@id} with bot getBotUser()



Author
DereWah
Downloads
425
Views
425
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from DereWah

Latest updates

  1. 2FA Utility!

    2FA Utility! Changelog: - Added a 2FA system. (See the main page for a tutorial on how to use...