mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Fix emoji not replacing or rendering, also fix visitor fetching 429 error
This commit is contained in:
parent
fbe41a9a35
commit
289fdc0eb5
@ -100,17 +100,12 @@ def check_user_in_guild(guild_id):
|
||||
return dbUser is not None and not checkUserRevoke(guild_id)
|
||||
|
||||
def parse_emoji(textToParse, guild_id):
|
||||
emojis = []
|
||||
emojis = re.findall(":(.*?):", textToParse)
|
||||
guild_emojis = get_guild_emojis(guild_id)
|
||||
newText = textToParse
|
||||
for gemoji in guild_emojis:
|
||||
emoji_name = gemoji["name"]
|
||||
emoji_id = gemoji["id"]
|
||||
for usremote in emojis:
|
||||
if usremote == emoji_name:
|
||||
newText = newText.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
||||
return newText
|
||||
textToParse = textToParse.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
||||
return textToParse
|
||||
|
||||
|
||||
def format_post_content(guild_id, message):
|
||||
|
@ -38,6 +38,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
String.prototype.replaceAll = function(target, replacement) {
|
||||
return this.split(target).join(replacement);
|
||||
};
|
||||
|
||||
function query_guild() {
|
||||
var url = "/api/query_guild";
|
||||
if (visitor_mode) {
|
||||
@ -533,7 +537,7 @@
|
||||
var emoji = emoji_store[i];
|
||||
var emoji_format = "<:" + emoji.name + ":" + emoji.id + ">";
|
||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name}).trim();
|
||||
message.content = message.content.replace(emoji_format, rendered);
|
||||
message.content = message.content.replaceAll(emoji_format, rendered);
|
||||
}
|
||||
return message;
|
||||
}
|
||||
@ -621,9 +625,12 @@
|
||||
$('#loginmodal').modal('open');
|
||||
Materialize.toast('Session expired! You have been logged out.', 10000);
|
||||
}
|
||||
setVisitorMode(true);
|
||||
if (visitor_mode) {
|
||||
fetchtimeout = setTimeout(run_fetch_routine, 5000);
|
||||
|
||||
if (data.status != 429) {
|
||||
setVisitorMode(true);
|
||||
if (visitor_mode) {
|
||||
fetchtimeout = setTimeout(run_fetch_routine, 5000);
|
||||
}
|
||||
}
|
||||
});
|
||||
fet.catch(function(data) {
|
||||
|
Loading…
Reference in New Issue
Block a user