def discordEmbeddedPush(self, embed):
"""
Send embedded message to discord bot huehue
"""
data = json.dumps({"embeds": [embed]})
req = urllib2.Request(self._discordWebhookUrl, data, {
'Content-Type': 'application/json',
"User-Agent": "B3DiscordbanPlugin/1.1" #Is that a real User-Agent? Nope but who cares.
})
# Final magic happens here, we will never get an error ofcourse ;)
try:
urllib2.urlopen(req)
except urllib2.HTTPError as ex:
self.debug("Cannot push data to Discord. is your webhook url right?")
self.debug("Data: %s\nCode: %s\nRead: %s" % (data, ex.code, ex.read()))
评论列表
文章目录