Discord (2/3): How to Create a Discord Community and Bot for Your Brand

  • Kim Dodds
  • Tuesday, May 31, 2022
blog-image

Our blog post, “Discord: A New Frontier for Customer Engagement”, covered Discord’s rise in popularity, and how brands can capitalize on this new social platform to form their own online communities and engage with customers. In this blog, we’ll walk through how to create a new official server for your brand, including how to connect a bot, which can automate tasks like moderation, bug reporting, announcements, etc.

Table of Contents

Setting up the Server

Create a New Discord Server

From within the discord application, click the “Add Server” button on the bottom left-hand side.

Creating a new Discord server.

Prompt when creating a new Discord server.

You can select from a template if you want to start out with some channels that are created for you, or you can start with a blank slate. And the first step is as easy as that, your server is created!

A newly created Discord server.

A newly created Discord server.

Convert the Server to a “Community Server”

It is highly recommended to enable the “community” features of the discord server. By converting to a community server, you enable extra tools that can help moderate, run, and grow the server. In particular, community servers have access to the following features:

  • Welcome Screen: Introduces new users to your server
  • Announcement Channel: Allows you to broadcast messages to your users
  • Server Insights: view analytics about your community and users
  • Discovery: Advertise your community on Discord’s Server Directory

Next to the server name in the top left corner, click the drop down and select “Server Settings”. Click the “Enable Community” tab on the left hand side and select “Get Started”.

Converting  a regular Discord server to a community server.

Enabling the community server settings.

Proceed through the required setup. Enabling community requires your server to perform additional verification for users, enable a chat filter, and set up a rules channel.

Setup for a community Discord server.

Setting up the community server.

Once you enable community, you have access to several new features. Two of the most useful features are the welcome message and the membership screening:

Server welcome message example.

Server welcome message example.

Membership screening settings.

Membership screening settings.

Set up Channels, Events, and Other Features

After setting up the community server, you have access to new features from the main server page as well.

Creating a new channel in a Discord server.

Creating a new channel.

Example of a Discord community server's channels.

Community server channels.

When you create a new channel, you have access to two new channel types: announcement and stage. The announcement channel can only be posted in by moderators, and is useful for official posts and announcements - a lot of servers will have bots automatically post their official twitter feed or forum posts to this channel. The “stage” channel is a special kind of voice channel that is useful for hosting events with a live audience. The host has the ability to moderate other speakers (unlike in a regular voice channel, where it’s a free-for-all).

Once your server is all set up, it may look something like this:

Fully customized Discord server.

Fully customized community server.

Get the Word Out!

Once your server is all set up, you can start inviting people! Discord offers a free premade widget, which can be embedded in any website to advertise your server.

Discord server widget settings.

Server widget settings.

An example of a working widget for Seasalt.ai’s Near Me Messaging Discord server.

To build trust with potential users, you can optionally reach out to Discord support to get your server verified. Verification will place a “verified” icon next to your server name which indicates that the server is the officially affiliated community of a business, brand, and figure of public interest. You can see verification requirements on Discord’s official site.

Once your server gets off the ground and has a good number of users, Discord offers more opportunities to advertise your server internally. When your server is at least 8 weeks old and has 500+ users, you can apply for Discord partnership, which gives your server special partner-exclusive perks. Once you hit 1,000+ users, you can join the Server Discovery, which will allow anyone using Discord to discover and join your server.

Discord Discovery settings and requirements.

Discord Discovery settings and requirements.

Setting up the Discord Bot

Now that you’ve set up a server, you can enhance it by adding a bot to automate some processes, such as moderation, user feedback, and announcements. Keep reading the following section to learn how to set up a simple bot, and then stay tuned for the next blog in our series to see how you can integrate a fully-fledged customer service experience within your discord server.

Create a new Bot in the Discord Developer Portal

Create an account on the Discord Developer Portal. Create a “New Application” and name it.

Create a new application on Discord Developer Portal.

Discord developer dashboard: Applications.

Select your new application and click the “Bot” tab on the left-hand side.

Application's Bot settings.

Discord application settings.

Click “Add Bot” to create your discord bot.

Create a new Discord bot.

Creating a new Discord bot.

Once created, generate and copy the bot token. Finally, make sure that the messaging permissions are on.

Discord Bot messaging permissions.

Creating a new Discord bot.

Create a Simple Discord Bot with PyCord

We use the PyCord library as a Python wrapper for the discord API.

  1. Install PyCord and create a new Python file for your discord bot.
  2. Import the discord package and create an instance of the discord client.
  3. Use the event wrapper of the client to create an on_message method. This method will receive every message sent to a channel that the bot has access to. a. Within the method, first check if the message is from the bot itself, and ignore if so. b. Otherwise, we’ll start by only reacting to messages starting with $bot - if the message starts with this, we’ll just respond to the same channel saying I got your message!.
  4. Finally, at the end of the script, make sure to run the discord client so that it starts listening for events in the channel.
import discord

discord_client = discord.Bot()
discord_token = xxxxxxxxxxxx
 
@discord_client.event
async def on_message(message):
    """Listen and react to messages."""
    # Check if the message is from the bot itself
    if message.author == discord_client.user:
        return

    msg = message.content
    if msg.startswith("$bot") or isinstance(message.channel, discord.DMChannel):
        await message.channel.send(I got your message!”)

discord_client.run(discord_token)

A Note on Python Discord Clients

The Discord.py is the most popular project for Python wrapper for the discord API, however, the author and maintainer decided to retire the library. You can find many alternative Python wrappers for Discord API, and many are forks of the original Discord.py. We chose to use PyCord because it seems well-maintained, already supports Slash Commands, and has a discord server where we can ask questions.

When you create the discord bot, try not to install other discord python packages. The discord python packages don’t usually work well together since they are all under separate development. For example, PyCord does not work well with discord-components so make sure you don’t have both packages installed at the same time.

Invite the Discord Bot

Next, you can invite the bot to your server. Click on the “OAuth2” -> “URL Generator”. On the URL Generator on the right, select “bot”.

Generate an invite link for the Discord bot.

Generating an invite link for the bot.

Next, scroll down to add permissions to the bot. You can make the bot admin, or just select the permissions you need (this is safer).

Discord bot permission settings.

Bot permission settings.

Finally, copy the URL generated at the bottom and open the link in a new tab. The link will redirect you to add the bot to a server that you manage.

Add the bot to the Discord server.

Adding the bot to the server.

After the bot is invited to the server, click on the bot and click “Add to Server”. You will be asked to give “Create Commands in the Server” permission to the bot.

Confirm Discord bot permissions.

Confirm the bot’s permissions in the server.

Test the Integration

Now your bot should be hooked up and listening to all the action in your Discord server. The sample bot provided in the code above will simply respond “I got your message!” if someone types a message that starts with the string “$bot”. String matching like this is the easiest way to set up some actions for your bot. However, Discord also supports native application commands that have more feature support. You can read more about those in the official Discord API documentation. Once you get your initial bot integration set up, the sky’s the limit with what services your bot can provide to your server.

Keep an eye out for the final post in our blog series, which will walk through how we used our product, SeaX, to connect Twilio Flex’s contact center platform with a community Discord server. This integration allows brands to not only foster community with their customers, but to maintain a direct channel of communication and address problems from directly within the online community.

For more information about any of our solutions, visit Seasalt.ai’s Product Wiki - or fill out the “Book a Demo” form to get a first-hand look.