Pivity

Three's Discord Logs - Discussion and Developer Documentation

Last read Never
#1

##Three's Discord Logs Discussion Hey guys, this is the thread for Three's Discord Logs. Feel free to ask any questions about the script here, including support for other scripts/gamemodes and other suggestions.

#Developer API This script is built on TDW, my Discord webhook wrapper. Here is the documentation for TDW that allows you to interact with a webhook with ease. Everything here is 100% serverside.

##Webhook ####Webhook TDW.CreateWebhook(string url) Creates a new webhook, passing in a Discord Webhook URL. You can access the webhook that Three's Discord Logs creates for you on startup by accessing global TDW.Webhook, following the webhook URL in the addon's configuration.

####void webhook:SetName(string name) Webhooks can overwrite the name/avatar set in the Discord webhook configuration. You can overwrite the name with this function. This will be applied for every message sent after this function is called, up until when the name is set again, or when it is reset.

####void webhook:SetAvatar(string avatar) Same as above. Takes the image URL of an avatar.

####void webhook:ResetName() Resets the webhook's name, set through SetName.

####void webhook:ResetAvatar() Resets the webhook's avatar, set through SetAvatar.

####void webhook:ResetProfile() Resets both the webhook's avatar and name.

####void webhook:Send(table content) Sends raw data to Discord's webhook API. You usually shouldn't need to do this, use one of the three helper methods below unless you have a good reason not to. The structure of the data is available on Discord's API documentation, here: https://discordapp.com/developers/docs/resources/webhook#execute-webhook

####void webhook:SendMessage(string message) Sends a text message to the webhook.

####void webhook:SendEmbed(RichEmbed embed) Sends an embed object to the webhook.

####void webhook:SendAttachment(Attachment attachment) Sends an attachment object to the webhook.

##RichEmbed ####RichEmbed TDW.RichEmbed() Creates a new RichEmbed object for sending through TDW.SendEmbed().

####void richEmbed:SetTitle(string title) Sets the title of the embed.

####void richEmbed:SetDescription(string description) Sets the description of the embed.

####void richEmbed:SetURL(string url) Sets the URL of the embed. This is opened when someone clicks the title.

####void richEmbed:SetTimestamp(table time) Sets a timestamp on the embed. If no timestamp is provided, it defaults to the current time. Structure: https://wiki.garrysmod.com/page/Structures/DateData

####void richEmbed:SetColor(Color|number color) Sets the color of the embed. This can be either a color object, or a hex number (0xFFFFFF)

####void richEmbed:SetFooter(string footer[, string iconUrl]) Sets the footer of the embed. Footers can have icons too, iconURL will set it. Must be a valid URL to an image.

####void richEmbed:SetImage(string url) Sets the image of the embed.

####void richEmbed:SetAuthor(string name[, string iconUrl[, string url]]) Sets the author of the embed. Authors can have images, set it iconUrl. If you supply url, it will be opened when the author is clicked on.

####void richEmbed:AddField(string name, string value[, bool inline = false]) Adds a field to the embed.

##Attachment ####Attachment TDW.Attachment([string url[, string filename]]) Creates a new attachment object for sending through TDW.SendAttachment(). URL and filename are explained below.

####void attachment:SetURL(string url) Sets the URL of the attachment. The file at this location will be uploaded to Discord as a file upload. E.g. If it's an image, you'll see an image uploaded.

####void attachment:SetFileName(string filename) Sets the filename of the attachment.

##Steam API ####Steam TDW.SteamAPI(string apiKey) TDW includes a basic Steam API wrapper that lets you get user info, which is cached internally. This is used internally for getting avatar URLs for events. You can access the Steam instance that Three's Discord Logs creates for you on startup by accessing global TDW.Steam, following the Steam API key in the configuration.

####string steam:FormatSteamID(Player|string steamid) You can pass in a SteamID32, SteamID64, or a player, and it will always return the SteamID64.

####void steam:GetPlayerInfo(string steamid, function callback(table info)) Gets player info from the Steam API, and returns it in the callback function. SteamID must be 64 bit, you should use steam:FormatSteamID() for this. Info takes this structure: https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerSummaries_.28v0002.29 Adds a field to the embed.

Winner x 2Friendly x 1
#2

ghomes suppporrrtt ???

Agree x 1
#3
ByLapinat 28th of May 2018 04:44:24
ghomes suppporrrtt ???

give hook for when people buy houses and shit

#4

I will be buying the script <3

Friendly x 1
#5

How do I even connect it to my server?

Users viewing this thread
Nobody