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