Show logged on users and channels from Discord on website

56 Views Asked by At

We're currently moving our teams over from TeamSpeak to Discord. For Teamspeak we had the tsviewer.com widget in order to show all channels and the active users on our website. I've tried looking for something similar for Discord, is that possible?

The website is built on .NET Core 8 and there's no problems creating an API-endpoint or similar if that's needed, but I've tried digging through the discord docs and I can't really find any article discussing this topic.

2

There are 2 best solutions below

0
Tito On BEST ANSWER

You could host a discord bot and add it to your discord server with endpoints in the context of the discord API which has full access (if given privileges) to all the server info including voice channels and members connected

Discord Developer Portal

Endpoint logic would look something like this with the Discord.NET library
Discord.NET Docs

private readonly DiscordSocketClient _client;
  List<VoiceChannelDto> voiceChannels = new();

  foreach (var guild in _client.Guilds)
  {
      if (guild.Id == MY_DISCOD)
      {
          foreach (var vc in guild.VoiceChannels)
          {
              VoiceChannelDto voiceChannel = new();
              voiceChannel.Name = vc.Name
              foreach (var user in vc.ConnectedUsers)
              {
                  voiceChannel.Users.Add(user.DisplayName)
              }
              voiceChannels.Add(voiceChannel);
          }
      }
  }

  return voiceChannels;

  // Voice Channel 1
  //      Member 1
  //      Member 2

  // Voice Channel 2
  //      Member 3
  //      Member 4
0
Keith Russo On

Discord also has a native widget. You can find all the details about it inside your server settings. It is disabled by default, but enabling it is a simple toggle switch.

However, it does not seem to be accessible via the mobile app (checked on Android, not sure about iOS), so you will need a desktop client to find your link and toggle switch.

The code you put on your website is nothing more than an <iframe /> tag, so should be simple enough to put it wherever you want it.

If you're looking for something that has a little more functionality than the default Discord widget, check out Widget Bot. It has a lot more customization options available.