Welcome Message HTML - I need help :)

So recently I’ve been trying to create an admin chat on my welcome message that has a password, and it’s like a pop up chat box where you can type directly from there, so none of the admins have to edit the welcome message and mess up the code I’ve already put in it. Does anyone have any suggestions or know how to do this?

You can’t do this and have it saved just in the welcome message. There are services out there (google finds several) that let you configure a chat box that calls their website, but you’re honestly better off using a dedicated chat service like Discord. You can even let everyone join the server and then create a channel just for staff.

If you really need it to just be in the welcome message, and can’t use another service… you can limit the accidental damage that admins can do by having them type their messages into a custom script tag (a HTML comment would also work, but it is easier to deal with script tags)

Note that this is not a private chat. The password is visible in the page source, and hackers can easily access the html source of your welcome message.

<script type="admin-chat" password="pass">
Bib - Hi there
Other - Hello
Someone else - I banned HACKER!@#@!
</script>

<button id="admin-chat">Reveal admin chat</button>

<script>
  addEventListener('load', function() {
    const button = document.querySelector('#admin-chat')
    const chat = document.querySelector('script[type=admin-chat]')
    button.addEventListener('click', function() {
      if (prompt('Enter password') === chat.getAttribute('password')) {
        const chatEl = chat.insertAdjacentElement('afterend', document.createElement('pre'))
        chatEl.textContent = chat.textContent
        button.remove()
      }
    })
  })
</script>
1 Like

Thank you so much for your help! I’ll look into getting a discord for the server :slight_smile:

Keep in mind that it might take a bit of time for you to get used to Discord. It’s quite different from any other chat service. :slightly_smiling_face:

it’s fine, i’ve had discord before and i’m pretty used to it but i just was looking for an in game option :slight_smile:

Coming back to this, I need to amend my recommendation of an embedded chat box. They aren’t permitted. It’s fine if the user has to leave the game, but not embedded.

2 Likes