How can I make Adonis Admin Logs via Discord Webook?
Asked by
5 years ago Edited 5 years ago
I've tried basically everything, but nothing I find seems to work! If somebody knows how to do this, please tell me, it would really help me. The code I've tried but doesn't seem to work usually is something along the lines of this
02 | local WebhookToken = "" |
07 | local Http = game:GetService( "HttpService" ) |
08 | local webHook = require(script.WebhookAPI) |
09 | local Discord_Webhook = webHook.new(WebhookId,WebhookToken) |
10 | local PlaceName = game:GetService( 'MarketplaceService' ):GetProductInfo(game.PlaceId).Name |
15 | function LvlFromNum(p) |
16 | local level = server.Admin.GetLevel(p) |
19 | elseif level > = 3 then |
21 | elseif level > = 2 then |
23 | elseif level > = 1 then |
30 | service.Events.CommandRan:connect( function (p,msg,command,args,index,table,ran, error ) |
34 | if args and #args > 1 then |
35 | for i,v in pairs (args) do |
43 | username = 'Command Logs' , |
49 | value = tostring (p.Name).. ' | ' ..LvlFromNum(p) |
57 | value = tostring (command) |
68 | text = tostring (PlaceName).. ' | ' .. tostring (service.GetTime()) |
And the Webhook API Script is
03 | webHook.__index = webHook |
05 | local Http = game:GetService( "HttpService" ) |
07 | function webHook.new(id,key) |
08 | local mt = setmetatable ( { id = id,key = key } , webHook) |
12 | function webHook:post(config,host) |
15 | local success = pcall ( function () |
16 | data = Http:JSONEncode(config) |
20 | warn( "Conversion error, please re-check your data." ) |
Please help if you can, thank you!