mirror of
https://gitlab.com/chicken-riders/RcGcDb.git
synced 2025-02-23 00:54:09 +00:00
Implement 36c4ba2b7c
as well as for comparing length of strings use byte comparison instead
This commit is contained in:
parent
de6e698888
commit
d85fce2ba3
|
@ -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": "❓"
|
||||
}
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue