|
| 1 | +--- |
| 2 | +title: it-drugs - Webhook Setup |
| 3 | +description: With the script, it is also possible to create your own consumable drugs directly. |
| 4 | +--- |
| 5 | + |
| 6 | +import ExternLink from '@components/ExternLink' |
| 7 | +import { Callout } from '@components/Callout' |
| 8 | +import {IconBrandDiscord} from '@tabler/icons-react' |
| 9 | + |
| 10 | +# Webhook Setup |
| 11 | +With version `1.3.0` of it-drugs the creation of webhooks is changing. From now on the webhooks are set entirely in the file `server/sv_webhooks`. |
| 12 | + |
| 13 | +```lua |
| 14 | +local webhookSettings = { |
| 15 | + ['active'] = false, -- Set to true to enable the webhook |
| 16 | + ['name'] = 'it-drugs', -- Name for the webhook |
| 17 | + ['avatar'] = 'https://i.imgur.com/KvZZn88.png', -- Avatar for the webhook |
| 18 | + ['urls'] = { |
| 19 | + ['plant'] = nil, --'', -- Webhook URL for plant actions |
| 20 | + ['table'] = nil, --'', -- Webhook URL for table actions |
| 21 | + ['sell'] = nil, --'', -- Webhook URL for sell actions |
| 22 | + ['message'] = nil, --'', -- Webhook URL for messages |
| 23 | + } |
| 24 | +} |
| 25 | +``` |
| 26 | + |
| 27 | +It is now possible to use your own webhook links for the various individual actions of the user. |
| 28 | + |
| 29 | +If a valid webhook id is entered and the attribute active is set to true, a webhook message is sent for the corresponding category. |
| 30 | + |
| 31 | +```lua |
| 32 | +local webhookSettings = { |
| 33 | + ['active'] = true, -- Set to true to enable the webhook |
| 34 | + ['name'] = 'it-drugs', -- Name for the webhook |
| 35 | + ['avatar'] = 'https://i.imgur.com/KvZZn88.png', -- Avatar for the webhook |
| 36 | + ['urls'] = { |
| 37 | + ['plant'] = 'https://discord.com/api/webhooks/**************/*************************', -- Webhook URL for plant actions |
| 38 | + ['table'] = nil, --'', -- Webhook URL for table actions |
| 39 | + ['sell'] = nil, --'', -- Webhook URL for sell actions |
| 40 | + ['message'] = nil, --'', -- Webhook URL for messages |
| 41 | + } |
| 42 | +} |
| 43 | +``` |
| 44 | +In this example now the script only sends webhook messages when a user interacts with a plant. |
| 45 | + |
| 46 | +<Callout type="info"> |
| 47 | +Please note that only messages with in the sell and message area will be sent immediately. |
| 48 | +The messages for plants and tables are sent every minute all together to prevent Discord from rate limiting your Discord server |
| 49 | +</Callout> |
| 50 | + |
| 51 | +You don't know how to create Discord webhooks no problem check this article from Discord. |
| 52 | + |
| 53 | +<ExternLink |
| 54 | + href="https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks" |
| 55 | + manualTitle="Intro to Webhooks" |
| 56 | + icon = {IconBrandDiscord} |
| 57 | +/> |
0 commit comments