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)
|
return dbUser is not None and not checkUserRevoke(guild_id)
|
||||||
|
|
||||||
def parse_emoji(textToParse, guild_id):
|
def parse_emoji(textToParse, guild_id):
|
||||||
emojis = []
|
|
||||||
emojis = re.findall(":(.*?):", textToParse)
|
|
||||||
guild_emojis = get_guild_emojis(guild_id)
|
guild_emojis = get_guild_emojis(guild_id)
|
||||||
newText = textToParse
|
|
||||||
for gemoji in guild_emojis:
|
for gemoji in guild_emojis:
|
||||||
emoji_name = gemoji["name"]
|
emoji_name = gemoji["name"]
|
||||||
emoji_id = gemoji["id"]
|
emoji_id = gemoji["id"]
|
||||||
for usremote in emojis:
|
textToParse = textToParse.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
||||||
if usremote == emoji_name:
|
return textToParse
|
||||||
newText = newText.replace(":{}:".format(emoji_name), "<:{}:{}>".format(emoji_name, emoji_id))
|
|
||||||
return newText
|
|
||||||
|
|
||||||
|
|
||||||
def format_post_content(guild_id, message):
|
def format_post_content(guild_id, message):
|
||||||
|
@ -37,6 +37,10 @@
|
|||||||
return ((elementTop <= pageBottom) && (elementBottom >= pageTop));
|
return ((elementTop <= pageBottom) && (elementBottom >= pageTop));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String.prototype.replaceAll = function(target, replacement) {
|
||||||
|
return this.split(target).join(replacement);
|
||||||
|
};
|
||||||
|
|
||||||
function query_guild() {
|
function query_guild() {
|
||||||
var url = "/api/query_guild";
|
var url = "/api/query_guild";
|
||||||
@ -533,7 +537,7 @@
|
|||||||
var emoji = emoji_store[i];
|
var emoji = emoji_store[i];
|
||||||
var emoji_format = "<:" + emoji.name + ":" + emoji.id + ">";
|
var emoji_format = "<:" + emoji.name + ":" + emoji.id + ">";
|
||||||
var rendered = Mustache.render(template, {"id": emoji.id, "name": emoji.name}).trim();
|
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;
|
return message;
|
||||||
}
|
}
|
||||||
@ -621,9 +625,12 @@
|
|||||||
$('#loginmodal').modal('open');
|
$('#loginmodal').modal('open');
|
||||||
Materialize.toast('Session expired! You have been logged out.', 10000);
|
Materialize.toast('Session expired! You have been logged out.', 10000);
|
||||||
}
|
}
|
||||||
setVisitorMode(true);
|
|
||||||
if (visitor_mode) {
|
if (data.status != 429) {
|
||||||
fetchtimeout = setTimeout(run_fetch_routine, 5000);
|
setVisitorMode(true);
|
||||||
|
if (visitor_mode) {
|
||||||
|
fetchtimeout = setTimeout(run_fetch_routine, 5000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fet.catch(function(data) {
|
fet.catch(function(data) {
|
||||||
|
Loading…
Reference in New Issue
Block a user