Raised This Month: $32 Target: $400
 8% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 02-11-2017 , 20:09   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #21

Here is a small fix for your API if using slack it's 'text' not 'content': json_object_set_new(hJson, hook.SlackMode ? "text" : "content", json_string(content));
__________________
zipcore is offline
blaacky
Senior Member
Join Date: Oct 2012
Old 06-16-2017 , 20:21   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #22

Can we get something to assign roles to members? And to get a list of roles
__________________

Last edited by blaacky; 06-17-2017 at 19:26.
blaacky is offline
romeo7
Senior Member
Join Date: Mar 2017
Old 08-26-2017 , 18:47   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #23

not working any update?
romeo7 is offline
Deathknife
Senior Member
Join Date: Aug 2014
Old 08-26-2017 , 19:12   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #24

Quote:
Originally Posted by romeo7 View Post
not working any update?
Great description there.

But yes, soon enough large update that will allow real-time listening to channels/events without constantly polling + more features and fixed overall. Working on it.
__________________
Deathknife is offline
romeo7
Senior Member
Join Date: Mar 2017
Old 08-27-2017 , 05:52   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #25

Quote:
Originally Posted by Deathknife View Post
Great description there.

But yes, soon enough large update that will allow real-time listening to channels/events without constantly polling + more features and fixed overall. Working on it.
sorry. i forgot add chrome console command. works fine. but little functions. waiting news. good lock!
romeo7 is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 08-27-2017 , 21:13   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #26

yummi
__________________
zipcore is offline
romeo7
Senior Member
Join Date: Mar 2017
Old 12-01-2017 , 01:53   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #27

"- Listen to messages on Channel" not working now. any fix?
romeo7 is offline
romeo7
Senior Member
Join Date: Mar 2017
Old 12-05-2017 , 02:51   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #28

cannot receive messages from discord, but can send from server. help
romeo7 is offline
Nextars
Junior Member
Join Date: Nov 2017
Old 12-13-2017 , 02:38   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #29

not working anymore
and where to put bot token in discord_Api.sp i can't find
Nextars is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-13-2018 , 15:16   Re: [ANY] Discord API (Send/Retrieve messages, list Guilds/Channels) UPDATE: 10/1/17
Reply With Quote #30

I tried a simple plugin to send all chat messages to discord and retrieve chat messages, 0 success, the error:

L 03/13/2018 - 19:504: [discord_api.smx] [DISCORD] Couldn't Retrieve Guilds - Fail 0 401

The code:

Code:
#pragma semicolon 1

#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <morecolors>
#include <discord>

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

DiscordBot gBot = null;
DiscordChannel gChannel = null;

public void OnPluginStart() {
	AddCommandListener(OnChatSent, "say");
}

public Action:OnChatSent(client, String:Command[], args)
{
	if(gBot == null || gChannel == null)
		return;
		
	char Message[200];
	GetCmdArgString(Message, sizeof(Message));
	
	StripQuotes(Message);
	if(Message[0] != '/' && Message[0] != '!')
	{
		char MessageSend[267];
		Format(MessageSend, sizeof(MessageSend), "%N: %s", client, Message);
		gBot.SendMessage(gChannel, MessageSend);
	}
}
public OnAllPluginsLoaded() {
	//Create bot with a token
	gBot = new DiscordBot("NDIzMTg2NzkwMDUzMDUyNDMy.DYmv2g.wKl067D8hID196rAtFVLLXqZrhs");
	
	//Get all guilds then channels to find any channel with the name of server-announcement
	gBot.GetGuilds(GuildList);
}

public void GuildList(DiscordBot bot, char[] id, char[] name, char[] icon, bool owner, int permissions, any data) {
	//Retrieve all channels for the guild
	bot.GetGuildChannels(id, ChannelList);
}

public void ChannelList(DiscordBot bot, char[] guild, DiscordChannel Channel, any data) {
	//Verify that the channel is a text channel
	if(Channel.IsText) {
		//Get name of channel
		char name[32];
		Channel.GetName(name, sizeof(name));
		
		//Compare name of channel to 'server-announcement'
		if(StrEqual(name, "game-chat", false)) {
			//Start listening to channel
			bot.StartListeningToChannel(Channel, OnMessage);
			gChannel = Channel;
		}
	}
}

public void OnMessage(DiscordBot Bot, DiscordChannel Channel, const char[] message, const char[] messageID, const char[] userID, const char[] userName, const char[] discriminator) {
	//Received a message, print it out.
	CPrintToChatAll("{green}[Discord]{normal} %s: %s", userName, message);
}
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Reply


Thread Tools
Display Modes

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 07:04.


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