diff --git a/src/api/template_settings.json b/src/api/template_settings.json index 6f142e8..c48f1af 100644 --- a/src/api/template_settings.json +++ b/src/api/template_settings.json @@ -151,7 +151,7 @@ "emoji": "🔓" }, "import/upload": { - "icon": "", + "icon": null, "color": 65280, "emoji": "📥" }, @@ -161,12 +161,12 @@ "emoji": "📥" }, "rights/rights": { - "icon": "", + "icon": null, "color": 16711680, "emoji": "🏅" }, "rights/autopromote": { - "icon": "", + "icon": null, "color": 16711680, "emoji": "🏅" }, @@ -206,12 +206,12 @@ "emoji": "📧" }, "curseprofile/comment-deleted": { - "icon": "", + "icon": null, "color": 16089376, "emoji": "🗑️" }, "curseprofile/comment-purged":{ - "icon":"", + "icon": null, "color": 16089376, "emoji": "👁️" }, @@ -221,237 +221,237 @@ "emoji": "📩" }, "curseprofile/profile-edited": { - "icon": "", + "icon": null, "color": 16089376, "emoji": "📌" }, "contentmodel/change": { - "icon": "", + "icon": null, "color": 25600, "emoji": "📋" }, "contentmodel/new": { - "icon": "", + "icon": null, "color": 25600, "emoji": "📋" }, "cargo/deletetable": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "📦" }, "cargo/createtable": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "📦" }, "cargo/replacetable": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "📦" }, "cargo/recreatetable": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "📦" }, "sprite/sprite": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🪟" }, "sprite/sheet": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🪟" }, "sprite/slice": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🪟" }, "managetags/create": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🏷️" }, "managetags/delete": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🏷️" }, "managetags/activate": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🏷️" }, "managetags/deactivate": { - "icon": "", + "icon": null, "color": 16776960, "emoji": "🏷️" }, "newusers/autocreate": { - "icon": "", + "icon": null, "color": 65280, "emoji": "🗿" }, "newusers/byemail": { - "icon": "", + "icon": null, "color": 65280, "emoji": "🗿" }, "newusers/create": { - "icon": "", + "icon": null, "color": 65280, "emoji": "🗿" }, "newusers/create2": { - "icon": "", + "icon": null, "color": 65280, "emoji": "🗿" }, "newusers/newusers": { - "icon": "", + "icon": null, "color": 65280, "emoji": "🗿" }, "newusers/reclaim": { - "icon": "", + "icon": null, "color": 65280, "emoji": "🗿" }, "managewiki/delete": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🗑️" }, "managewiki/lock": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🔒" }, "managewiki/namespaces": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "📦" }, "managewiki/namespaces-delete": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🗑️" }, "managewiki/rights": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🏅" }, "managewiki/settings": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "⚙️" }, "managewiki/undelete": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "♻️" }, "managewiki/unlock": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🔓" }, "datadump/generate": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "📤" }, "datadump/delete": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🗑️" }, "pagetranslation/mark": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/unmark": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/moveok": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/movenok": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/deletefok": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/deletefnok": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/deletelok": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/deletelnok": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/encourage": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/discourage": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/prioritylanguages": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/associate": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagetranslation/dissociate": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "translationreview/message": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "translationreview/group": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "pagelang/pagelang": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "🌐" }, "renameuser/renameuser": { - "icon": "", + "icon": null, "color": 8421504, "emoji": "📛" }, @@ -506,7 +506,7 @@ "emoji": "🗒️" }, "unknown": { - "icon": "", + "icon": null, "color": 0, "emoji": "❓" } diff --git a/src/discord/message.py b/src/discord/message.py index bfad337..51d251e 100644 --- a/src/discord/message.py +++ b/src/discord/message.py @@ -94,7 +94,7 @@ class DiscordMessage: if settings["event_appearance"].get(event_type, {"emoji": None})["emoji"]: content = settings["event_appearance"][event_type]["emoji"] + " " + content self.webhook_object["content"] = content - self.length = len(content) + self.length = len(content.encode('utf-8')) self.message_type = message_type self.event_type = event_type @@ -103,7 +103,7 @@ class DiscordMessage: """Set item is used only in embeds.""" try: if key in ('title', 'description', 'url'): - self.length += len(value) - len(self.embed.get(key, "")) + self.length += len(value.encode('utf-8')) - len(self.embed.get(key, "").encode('utf-8')) self.embed[key] = value except NameError: raise TypeError("Tried to assign a value when message type is plain message!") @@ -176,21 +176,21 @@ class DiscordMessage: raise EmbedListFull self.webhook_object["embeds"].append(self.embed) - def set_author(self, name: str, url="", icon_url=""): - self.length += len(name) + def set_author(self, name: str, url=None, icon_url=None): + self.length += len(name.encode('utf-8')) self.embed["author"]["name"] = name self.embed["author"]["url"] = url self.embed["author"]["icon_url"] = icon_url def set_footer(self, text: str, icon_url=""): - self.length += len(text) + self.length += len(text.encode('utf-8')) self.embed["footer"]["text"] = text self.embed["footer"]["icon_url"] = icon_url def add_field(self, name, value, inline=False): if "fields" not in self.embed: self.embed["fields"] = [] - self.length += len(name) + len(value) + self.length += len(name.encode('utf-8')) + len(value.encode('utf-8')) self.embed["fields"].append(dict(name=name, value=value, inline=inline)) def set_avatar(self, url):