Deathknife / sourcemod-discord

Discord API for Sourcemod
61 stars 36 forks source link

Implement SendMessageEmbed #9

Closed PaxPlay closed 6 years ago

PaxPlay commented 7 years ago

Implements natives to send messages with MessageEmbed objects.

The only problem I currently know of is that the MessageEmbed currently represents slacks embed json object and not Discords. This is a problem because i.e. the color object is a json string in slack and an integer in Discord so you won't be able to send messages using the color object. My solution would be to rename the current MessageEmbed object to SlackEmbed and create a MessageEmbed object that actually works with discord. DONT PUSH until this issue is solved.

I just wanted to know your opinion and how you would do it since this is your project.

EDIT: Also some commits might look strange since I used Atom and Atom automatically removes Tabs in empty lines and so on.

PaxPlay commented 7 years ago

Ehh, apparently the tabs are fucked up, wasn't like that for me lol. Renamed the old MessageEmbed to SlackEmbed because it represents slack's MessageEmbed object and not Discord's. Then I created a MessageEmbed Object which actually represents Discord's MessageEmbed object. SlackEmbed can only be used with slack mode webhooks, however, both can be added to both. Might need to implement a fix for that and clear the embeds when changing the mode (maybe convert). Also edited the examples for the none slack mode webhook and SendMessageEmbed.