mirror of
				https://github.com/TitanEmbeds/Titan.git
				synced 2025-10-30 13:29:08 +01:00 
			
		
		
		
	Implement join messages
This commit is contained in:
		| @@ -18,6 +18,7 @@ def get_formatted_message(message): | ||||
|         "author": get_message_author(message), | ||||
|         "timestamp": format_datetime(message.created_at), | ||||
|         "edited_timestamp": edit_ts, | ||||
|         "type": message.type.value, | ||||
|     } | ||||
|     if hasattr(message, "mentions"): | ||||
|         msg["mentions"] = get_message_mentions(message.mentions) | ||||
|   | ||||
| @@ -59,7 +59,8 @@ class RedisQueue: | ||||
|                 "channel_id": str(x["channel_id"]), | ||||
|                 "mentions": x["mentions"], | ||||
|                 "embeds": x["embeds"], | ||||
|                 "reactions": x["reactions"] | ||||
|                 "reactions": x["reactions"], | ||||
|                 "type": x.get("type", 0), | ||||
|             } | ||||
|             if message["author"]["id"] not in guild_members: | ||||
|                 member = self.get_guild_member(guild_id, message["author"]["id"]) | ||||
|   | ||||
| @@ -231,6 +231,20 @@ nav .brand-logo { | ||||
| /*  display: table-row*/ | ||||
| /*}*/ | ||||
|  | ||||
| #chatcontent .new-member .new-member-arrow { | ||||
|   color: green; | ||||
|   cursor: pointer; | ||||
|   vertical-align: bottom; | ||||
| } | ||||
|  | ||||
| #chatcontent .new-member .chatusername,  #chatcontent .new-member .authoravatar{ | ||||
|   display: none; | ||||
| } | ||||
|  | ||||
| #chatcontent .new-member .chatmessage { | ||||
|   display: inline; | ||||
| } | ||||
|  | ||||
| ::-webkit-input-placeholder { | ||||
|   color: #636363; | ||||
|   color: var(--placeholder); | ||||
|   | ||||
| @@ -1334,6 +1334,53 @@ | ||||
|             $("main").scrollTop($("#chatcontent").outerHeight()); | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     function format_new_member_message(message) { | ||||
|         var formats = [ | ||||
|             "{0} just joined the server - glhf!", | ||||
|             "{0} just joined. Everyone, look busy!", | ||||
|             "{0} just joined. Can I get a heal?", | ||||
|             "{0} joined your party.", | ||||
|             "{0} joined. You must construct additional pylons.", | ||||
|             "Ermagherd. {0} is here.", | ||||
|             "Welcome, {0}. Stay awhile and listen.", | ||||
|             "Welcome, {0}. We were expecting you ( ͡° ͜ʖ ͡°)", | ||||
|             "Welcome, {0}. We hope you brought pizza.", | ||||
|             "Welcome {0}. Leave your weapons by the door.", | ||||
|             "A wild {0} appeared.", | ||||
|             "Swoooosh. {0} just landed.", | ||||
|             "Brace yourselves. {0} just joined the server.", | ||||
|             "{0} just joined. Hide your bananas.", | ||||
|             "{0} just arrived. Seems OP - please nerf.", | ||||
|             "{0} just slid into the server.", | ||||
|             "A {0} has spawned in the server.", | ||||
|             "Big {0} showed up!", | ||||
|             "Where’s {0}? In the server!", | ||||
|             "{0} hopped into the server. Kangaroo!!", | ||||
|             "{0} just showed up. Hold my beer.", | ||||
|             "Challenger approaching - {0} has appeared!", | ||||
|             "It's a bird! It's a plane! Nevermind, it's just {0}.", | ||||
|             "It's {0}! Praise the sun! [T]/", | ||||
|             "Never gonna give {0} up. Never gonna let {0} down.", | ||||
|             "Ha! {0} has joined! You activated my trap card!", | ||||
|             "Cheers, love! {0}'s here!", | ||||
|             "Hey! Listen! {0} has joined!", | ||||
|             "We've been expecting you {0}", | ||||
|             "It's dangerous to go alone, take {0}!", | ||||
|             "{0} has joined the server! It's super effective!", | ||||
|             "Cheers, love! {0} is here!", | ||||
|             "{0} is here, as the prophecy foretold.", | ||||
|             "{0} has arrived. Party's over.", | ||||
|             "Ready player {0}", | ||||
|             "{0} is here to kick butt and chew bubblegum. And {0} is all out of gum.", | ||||
|             "Hello. Is it {0} you're looking for?", | ||||
|             "{0} has joined. Stay a while and listen!", | ||||
|             "Roses are red, violets are blue, {0} joined this server with you", | ||||
|         ]; | ||||
|         var index = moment(message.timestamp).unix() % formats.length; | ||||
|         var formatted = formats[index].replace(/\{0\}/g, message.author.username); | ||||
|         return "<i class=\"material-icons new-member-arrow\">arrow_forward</i> " + formatted; | ||||
|     } | ||||
|  | ||||
|     function fill_discord_messages(messages, jumpscroll, replace) { | ||||
|         if (replace === undefined) { | ||||
| @@ -1364,6 +1411,9 @@ | ||||
|             message = parse_emoji_in_message(message); | ||||
|             message.content = message.content.replace(/<https:\/\/(.*?)>/g, "https://$1"); | ||||
|             message.content = message.content.replace(/<http:\/\/(.*?)>/g, "http://$1"); | ||||
|             if (message.type == 7) { | ||||
|                 message.content = format_new_member_message(message); | ||||
|             } | ||||
|             var username = message.author.username; | ||||
|             if (message.author.nickname) { | ||||
|                 username = message.author.nickname; | ||||
| @@ -1384,6 +1434,9 @@ | ||||
|                 $("#chatcontent p:last-child").find(".channellink").click(function () { | ||||
|                     select_channel($(this).attr("channelid"), true); | ||||
|                 }); | ||||
|                 if (message.type == 7) { | ||||
|                     $("#chatcontent p:last-child").addClass("new-member"); | ||||
|                 } | ||||
|             } else { | ||||
|                 replace.html($(rendered).html()); | ||||
|                 replace.find(".blockcode").find("br").remove(); | ||||
| @@ -1558,7 +1611,7 @@ | ||||
|         for (var i = 1; i < allMessages.length; i++) { | ||||
|             var last = $(allMessages[i - 1]); | ||||
|             var current = $(allMessages[i]); | ||||
|             if (last.attr("discord_userid") == current.attr("discord_userid") && current.attr("discord_userid") && moment(current.attr("timestamp")).isSame(moment(last.attr("timestamp")), "hour")) { | ||||
|             if (!last.hasClass("new-member") && last.attr("discord_userid") == current.attr("discord_userid") && current.attr("discord_userid") && moment(current.attr("timestamp")).isSame(moment(last.attr("timestamp")), "hour")) { | ||||
|                 current.addClass("collapsed"); | ||||
|             } else { | ||||
|                 current.removeClass("collapsed"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user