Cleo Discord Webhook

Epepe

Новичок
Автор темы
7
0
Версия SA-MP
  1. 0.3.7 (R1)
Здравствуйте, не могли бы вы, пожалуйста, подсказать мне, как я могу настроить скрипт .cs для отправки сообщения вебхука Discord при присоединении человека к серверу?
 
  • Грустно
Реакции: de_clain

siwage

Активный
188
65
Я конечно не уверен что оно работать будет, нашёл хрен пойми где.
И вообще я не знаю что это
shit code:
{$CLEO}
0000: NOP

repeat
    wait 0
until 0AFA:

// host
alloc 0@ 30
0AD3: 0@ = format "discordapp.com"

// path
alloc 1@ 200
call @construct_path 1 1@ // reads discord.ini and stores result at 1@

// data
alloc 2@ 1000
//0AD3: 2@ = format "content=testing message"
0AD3: 2@ = format "content=testing message&username=custom_username"

// response buffer
alloc 3@ 1500

while true
    wait 0
    if and
    not SAMP.ChatInputOpened()
    0ADC: "X"
    then
        0AB1: call_scm_func @HTTP_POST 5 host 0@ file_path 1@ response_buffer 3@ data 2@ is_https true _ret_is_success 31@
        if
        31@ == true
        then
            chatmsg "Respuesta = %s" 0xFFFFFF 3@
        else
            chatmsg "Fail" -1
        end
    end
end

:construct_path
{
    Params:
    0@ - pointer to path
}
alloc 30@ 200
alloc 31@ 200
0AF4: 30@ = read_string_from_ini_file "cleo\discord.ini" section "my_server" key "webhook_channel_id"
0AF4: 31@ = read_string_from_ini_file "cleo\discord.ini" section "my_server" key "webhook_token"
0AD3: 0@ = format "api/webhooks/%s/%s" 30@ 31@
free 30@
free 31@
ret 0

{$INCLUDE includes/http_requests.txt}

cleo/discord.ini >

shit code:
[my_server]
webhook_token=ВебХук_токен
webhook_channel_id=ВебХук Канал Айди
 

Epepe

Новичок
Автор темы
7
0
Я конечно не уверен что оно работать будет, нашёл хрен пойми где.
И вообще я не знаю что это
shit code:
{$CLEO}
0000: NOP

repeat
    wait 0
until 0AFA:

// host
alloc 0@ 30
0AD3: 0@ = format "discordapp.com"

// path
alloc 1@ 200
call @construct_path 1 1@ // reads discord.ini and stores result at 1@

// data
alloc 2@ 1000
//0AD3: 2@ = format "content=testing message"
0AD3: 2@ = format "content=testing message&username=custom_username"

// response buffer
alloc 3@ 1500

while true
    wait 0
    if and
    not SAMP.ChatInputOpened()
    0ADC: "X"
    then
        0AB1: call_scm_func @HTTP_POST 5 host 0@ file_path 1@ response_buffer 3@ data 2@ is_https true _ret_is_success 31@
        if
        31@ == true
        then
            chatmsg "Respuesta = %s" 0xFFFFFF 3@
        else
            chatmsg "Fail" -1
        end
    end
end

:construct_path
{
    Params:
    0@ - pointer to path
}
alloc 30@ 200
alloc 31@ 200
0AF4: 30@ = read_string_from_ini_file "cleo\discord.ini" section "my_server" key "webhook_channel_id"
0AF4: 31@ = read_string_from_ini_file "cleo\discord.ini" section "my_server" key "webhook_token"
0AD3: 0@ = format "api/webhooks/%s/%s" 30@ 31@
free 30@
free 31@
ret 0

{$INCLUDE includes/http_requests.txt}

cleo/discord.ini >

shit code:
[my_server]
webhook_token=ВебХук_токен
webhook_channel_id=ВебХук Канал Айди
Код не работает, при нажатии на X выдает сообщение FAIL. У вас есть другой, работающий API?