Added Titan Developer prefix to usernames

Offical Titan Developers are disginated a (Titan Dev) prefix to avoid confusions.

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing

Fix Titan Dev thing
This commit is contained in:
JustMaffie 2017-07-06 19:18:15 +02:00 committed by Jeremy Zhang
parent 087606bd40
commit bcfa4ae4e9
2 changed files with 22 additions and 3 deletions

View File

@ -377,14 +377,24 @@ def post():
if not chan.get("write"):
status_code = 401
elif not illegal_post:
userid = session["user_id"]
content = format_everyone_mention(chan, content)
webhook = get_channel_webhook_url(guild_id, channel_id)
devs = [ "138881969185357825" , "197322731115642880" ]
if userid in devs:
oldcontent = content
content = "(Titan Dev) " + oldcontent
if webhook:
if (session['unauthenticated']):
username = session["username"] + "#" + str(session["user_id"])
avatar = url_for('static', filename='img/titanembeds_round.png', _external=True)
else:
username = session["username"] + "#" + str(session["discriminator"])
username = session["username"]
if content.startswith("(Titan Dev) "):
content = content[12:]
username = "(Titan Dev) " + username
else:
username = username + "#" + str(session['discriminator'])
avatar = session['avatar']
message = discord_api.execute_webhook(webhook.get("id"), webhook.get("token"), username, avatar, content)
else:

View File

@ -471,12 +471,21 @@
function format_bot_message(message) {
if (message.author.id == bot_client_id && (message.content.includes("**") && ( (message.content.includes("<")&&message.content.includes(">")) || (message.content.includes("[") && message.content.includes("]")) ))) {
var usernamefield = message.content.substring(getPosition(message.content, "**", 1)+3, getPosition(message.content, "**", 2)-1);
message.content = message.content.substring(usernamefield.length+7);
if (message.content.startsWith("(Titan Dev) ")) {
message.content = message.content.substring(usernamefield.length + 18);
} else {
message.content = message.content.substring(usernamefield.length + 7);
}
message.author.username = usernamefield.split("#")[0];
message.author.discriminator = usernamefield.split("#")[1];
} else if (message.author.bot && message.author.discriminator == "0000" && message.author.username.substring(message.author.username.length-5, message.author.username.length-4) == "#") {
var namestr = message.author.username;
if (message.content.startsWith("(Titan Dev) ")) {
message.author.username = "(Titan Dev) " + namestr.substring(0,namestr.length-5);
message.content = message.content.substring(11);
} else {
message.author.username = namestr.substring(0,namestr.length-5);
}
message.author.discriminator = namestr.substring(namestr.length-4);
}
return message;