Jump to content
minipopov

[Release] Send request to my bot discord

Recommended Posts

As exemple for this topic:https://forums.bohemia.net/forums/topic/213192-release-oo_webservice-class-using-oop/

I create a bot discord:https://github.com/minipopov/DiscordBotExemple

 

I create BaseFnc class, which have 2 antiflood system, one per user, one per call by everyone. i add a function named "sendGlobal" which send a text main channel on my discord:

const globalMessage = new BaseFnc("sendGlobal", 10) // name of my function, time for antiflood
globalMessage.setFloodProtection("perUser") // antiflood system perUser/perCall
globalMessage.setCallback((params, steamID) => { // My callback
	chanGeneral.send(params.text)
});

Then i import to my mission oo_Webservice and i create a class oo_Discord which use Webservice. You could check my mission:https://github.com/minipopov/Discord

 

oo_Discord have 1 function "sendGlobal" which send httpRequest with those args:

    action => name of function to exec

    steamID => Who execute this call

    text => message to display on discord

Now i make call 

private _discord = ["new", "http://localhost:8080/"] call oo_Discord;
["sendGlobal","Hello world!"] call _discord;

I get this on my discord:

http://prntscr.com/i1trv6

 

Make your own function function and imagine may be some new game/ interaction with people.

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×