View Single Post
Trum
AlliedModders Donor
Join Date: Jan 2017
Old 08-12-2020 , 18:10   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #48

I'm trying to compile the example plugin but I get errors I don't know how to fix:
Code:
dctest.sp(24) : error 172: methodmap 'DiscordWebHook' does not have a constructor
dctest.sp(24) : warning 213: tag mismatch
dctest.sp(25) : error 105: cannot find method or property DiscordWebHook.SetUsername
dctest.sp(26) : error 105: cannot find method or property DiscordWebHook.SlackMode
dctest.sp(26) : warning 213: tag mismatch
dctest.sp(27) : error 105: cannot find method or property DiscordWebHook.SetContent
dctest.sp(28) : error 105: cannot find method or property DiscordWebHook.Send
Why am I getting those errors with this code?
PHP Code:
#pragma semicolon 1

#define PLUGIN_VERSION "1.10"

#include <sourcemod>
#include <discord>

#define WEBHOOK "mywebhookurl"

public Plugin myinfo 
{
    
name "Discord Test",
    
author "Deathknife",
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart() {
    
RegConsoleCmd("sm_webhooktest"Cmd_Webhook);
}

public 
Action Cmd_Webhook(int clientint argc) {
    
DiscordWebHook hook = new DiscordWebHook(WEBHOOK);
    
hook.SetUsername("Testing");
    
hook.SlackMode false;
    
hook.SetContent("Testing 1 2 3");
    
hook.Send();
    
delete hook;

I have placed the discord.inc inside the /include/ folder, then compiling my plugin but I get those errors.

Have I missed something?
Trum is offline