Browse Source

Implicitly cast Embed construction parameters to str

pull/6580/head
pikaninja 4 years ago
committed by GitHub
parent
commit
5a93e80e87
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      discord/embeds.py

18
discord/embeds.py

@ -116,6 +116,15 @@ class Embed:
self.url = kwargs.get('url', EmptyEmbed)
self.description = kwargs.get('description', EmptyEmbed)
if self.title is not EmptyEmbed:
self.title = str(self.title)
if self.description is not EmptyEmbed:
self.description = str(self.description)
if self.url is not EmptyEmbed:
self.url = str(self.url)
try:
timestamp = kwargs['timestamp']
except KeyError:
@ -149,6 +158,15 @@ class Embed:
self.description = data.get('description', EmptyEmbed)
self.url = data.get('url', EmptyEmbed)
if self.title is not EmptyEmbed:
self.title = str(self.title)
if self.description is not EmptyEmbed:
self.description = str(self.description)
if self.url is not EmptyEmbed:
self.url = str(self.url)
# try to fill in the more rich fields
try:

Loading…
Cancel
Save