Template:DiscordMessage: Difference between revisions

From ServantPedia™, the paid (but reliable) encyclopedia
Jump to navigation Jump to search
Created page with "<!-- Template:DiscordMessage --> <noinclude> This template creates Discord-like message formatting. == Usage == <pre> {{DiscordMessage |avatar=Example.jpg |username=Username |timestamp=01-Jan-21 12:00 AM |content=Message content here. Use @mention to ping someone. |mentions=mention1#1234,mention2#5678 }} </pre> </noinclude> <includeonly><div class="discord-message" style="display: flex; margin: 1em 0; padding: 0.5em; background: #36393f; border-radius: 4px; color: #dcdd..."
 
No edit summary
Line 24: Line 24:
<div class="content" style="white-space: pre-wrap;">{{#replace:{{{content}}}|@{{{mentions}}}|<span style="background: rgba(88,101,242,0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px;">@$1</span>}}</div>
<div class="content" style="white-space: pre-wrap;">{{#replace:{{{content}}}|@{{{mentions}}}|<span style="background: rgba(88,101,242,0.3); color: #c9cdfb; border-radius: 3px; padding: 0 2px;">@$1</span>}}</div>
</div></div></includeonly>
</div></div></includeonly>
<!-- CSS to be added to MediaWiki:Common.css -->
<pre>
/* Discord-like styling */
.discord-message {
font-family: 'Whitney', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
.discord-message img {
border-radius: 50%;
}
.discord-message .mention {
background: rgba(88,101,242,0.3);
color: #c9cdfb;
border-radius: 3px;
padding: 0 2px;
}
.preserve-whitespace {
white-space: pre-wrap;
}
</pre>

Revision as of 15:44, 7 April 2025


This template creates Discord-like message formatting.

Usage

{{DiscordMessage
|avatar=Example.jpg
|username=Username
|timestamp=01-Jan-21 12:00 AM
|content=Message content here.
Use @mention to ping someone.
|mentions=mention1#1234,mention2#5678
}}