Hi folks, today I have created a module you could use when scripting, or if you are new to scripting, to save you some precious time and effort.
Open-sourced code can be found here: General Functions | Webhook Module
Requiring the Modules
In order to use the module, you need to require it.
To get started, create a script, and respectively insert the line required for the library you wish to use.
local Functions = require(5495308850);
local Webhooks = require(5576797903);
Now you can get onto actually using the functions, which are explained below:
Using the Functions
Webhook Library
Function 1: SendQuote
In order to use this function, add a line of code in your script with the following details:
Webhook: The Discord webhook being used.
Message: The message you want sent.
Player: The player sending the quote.
To send the data, use the following in your script:
Webhooks:SendQuote(Webhook, Message, Player)
And it will post through the webhook a message like the following:
“Message” - Player Name
Function 2: SendMessage
In order to use this function, add a line of code in your script with the following details:
Webhook: The Discord webhook being used.
Message: The message you want sent.
To send the data, use the following in your script:
Webhooks:SendMessage(Webhook, Message)
And it will post through the webhook a message like the following:
Message
Function 3: SendEmbed
In order to use this function, add a line of code in your script with the following details:
Webhook: The Discord webhook being used.
Title: The embed title.
Description: The embed description.
To send the data, use the following in your script:
Webhooks:-SendEmbed(Webhook, Title, Description)
And it will post through the webhook an embed with the given title and description.
General Functions
Function 1: GetPlayerFromPartialName
To use this function, you need the following information:
PartialName: The partial name you wish to get the player from.
Add a line in your script with the following:
local Player = Functions:GetPlayerFromPartialName(PartialName)
This cycles through every player in the game until it finds a match and then returns that match.
NOTE: This returns a player, not a Name.
Function 2: HandTo
To use this function, you need the following information:
Sender: The player sending the tool.
Receiver: The player receiving the tool.
Add a line in your script with the following:
Functions:HandTo(Sender, Receiver)
What this does is it will search the sender’s character for the tool they are holding, and move it into the receivers backpack. Both the sender and receiver must be players, such as game.Players.Diamond9195
, not "Diamond9195"
.
Update Archive
Version: 1.1
-
Removed Function 5: GameAnnounce
– Could mess with a games color scheme -
Removed Function 7: GetGroupInfo
– Already covered bygame.GroupService:GetGroupInfoAsync()
-
Moved all Discord-side functions to a separate library
– Helps with readability when writing scripts.
Version: 1.0
Module released as a first draft to the public with 7 functions.
Suggestions/Improvements/Comments
I am open for any feedback you wish to give. If you would like a function added, please specify the function name and what it should do and tag me in the reply. If you have any improvements or comments feel free to reply to this post with them and I will be happy to reply.