Raised This Month: $51 Target: $400
 12% 

[ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Trum
AlliedModders Donor
Join Date: Jan 2017
Old 08-15-2020 , 14:36   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #29

What else do I need to send the message that I sent in my Discord channel to be sent in-game?

PHP Code:
#include <sourcemod>
#include <discord>

#pragma semicolon 1

#define BOT_TOKEN "mytoken"

DiscordBot gBot;

public 
void OnAllPluginsLoaded() {
    
gBot = new DiscordBot(BOT_TOKEN);
}

public 
void OnMessage(DiscordBot BotDiscordChannel ChannelDiscordMessage message) {
    
char sMessage[2048];
    
message.GetContent(sMessagesizeof(sMessage));
    
    
char sAuthor[128];
    
message.GetAuthor().GetUsername(sAuthorsizeof(sAuthor));
    
    
PrintToChatAll("[DISCORD] %s: %s"sAuthorsMessage);
    
    if(
StrEqual(sMessage"Ping"false)) {
        
gBot.SendMessage(Channel"Pong!");
    }

Trum is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode