How to Make Character AI Discord Bot & Turn Imagination Into Reality

With the rising popularity of both Artificial Intelligence and Discord, the road to the future seems quite fascinating. With a new bot making headlines every other day, it has become hard to keep up. One such AI bot Character AI is gaining popularity due to the act that it lets one interact with fictional characters of their choice. If you want to wish to make a Character AI Discord bot, then let us figure out How to Make Character AI Discord Bot.

Character AI is a versatile bot that has so many features, including the freedom of interacting with various fictional characters. With the combination of Discord and Character AI, the platform for community engagement creating a Character AI Discord bot has become an exciting way to add a touch of personality and interactivity to your server. Character AI Discord Link is an easy way to create a new experience for you. 

Keep scrolling to find out How to Make Character AI Discord Bot in some easy and simple steps. Make a character of your choice and turn your imagination into reality.

Requirements For Making Character AI Discord Bot

Character AI logo; How to Make Character AI Discord Bot & Turn Imagination Into Reality

Before getting started on making a Character AI Discord bot, there are some requirements that are prerequisites. These are:

1. A Discord account and a fresh bot application.

2. You will require an OpenAI account to engage in chat interactions.

3. You will require to sign up for an Autocode account.

4. You will require a fictional character of your choice from your favorite TV show, game, or movie.

How to Make Character AI Discord Bot?

To make the Character AI Discord Bot, there are a few steps to be followed. These are:

1. Go to the Discord Developer Portal and click on the New Application button located at the top right corner.

New Application option on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

2. Next, when prompted, give your bot a name of your choice, which will serve as the default name, and then click the Create button after accepting the terms.

3. Now, you will be asked to provide information for your bot, like an avatar and some description.

Providing your character info on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

4. Further go to the Bot tab, enable privilege intent and save changes.

Bot tab on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

5. Access the Autocode dashboard and tap on the New Web Service button.

New web services option on Autocode; How to Make Character AI Discord Bot & Turn Imagination Into Reality

6. Provide a name for your project and click on the Create Project button.

Create Project option on Autocode; How to Make Character AI Discord Bot & Turn Imagination Into Reality

7. After setting up our new project, let us begin by connecting our Discord account. In the Autocode editor’s left sidebar, locate the Link button and tap it.

Link option on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

8. Now, select the highlighted dropdown menu and opt for Discord.

9. At this point, a modal will appear, requesting you to associate a Discord development account. If you have previously linked a Discord bot using Autocode, those options will be displayed. However, for our specific requirements, tap on the Link New Resource button.

Link New resource option on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

10. In order to proceed, provide the client ID and client secret token for the character bot, which will grant you access to the Discord API on behalf of your bot.

Entering client ID on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

11. Follow the instructions on the screen to locate these credentials in the Discord Developer Portal, then enter them in the form on the right and Tap on Next Step.

12. Now, add a bots token and tap on Finish Linking.

Finishing linking Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

13. A Discord OAuth popup will appear, enabling you to invite your bot and configure its permissions correctly. After this, hit Authorize to invite your bot to the selected guild and establish the link between your credentials in Autocode.

Testing application on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

14. Tap on the Event Trigger button and set the source of your event trigger to Discord 1 and trigger to bot_ mention 2, and tap on Save Trigger.

Setting up Autocode; How to Make Character AI Discord Bot & Turn Imagination Into Reality

15. Before we proceed with writing our prompt, open the bot_mention.js file and substitute the existing boilerplate code with the following code snippet:

const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});

let author = context.params.event.author;

let botMention = context.params.event.mentions.find(mention => mention.bot);

let newMessage = context.params.event.content;

let historyKey = `character_bot__${author.id}_chat`;

let historyLength = 10; // 5 back-and-forth messages

let historyTTL = 600; // 10 minutes

And you are done! You have made your favorite Character AI Discord Bot.

How to Use Your Character AI Discord Bot?

Super Mario character on Discord; How to Make Character AI Discord Bot & Turn Imagination Into Reality

Now that you have made your Character AI Discord Bot let us learn how to use your Character AI Discord bot. To use, follow these steps:

1. First of all, create an empty array to push message objects to.

2. The system message serves as instructions to both OpenAI and our bot, guiding their behavior. It should encompass the bot’s objectives, the specific character it is impersonating, and any relevant details that can be utilized to shape its responses.

3. In the next line, add:

messages.push({

  role: 'system',

  content: [

    `You are a special character impersonator bot. Your main goal is to be fun and entertaining while staying in character.`,

    `Right now you are pretending to be the video game character Super Mario, and you have come to visit a Discord server.`,

    `You should never, EVER reveal when you are in disguise. For all intents and purposes, you are that character.`,

    `You are disguised as Mario, one of the Super Mario Brothers. Mario is the world's most beloved plumber.`,

    `Here are some helpful facts about Mario:`,

    ``,

    `Mario's brother is Luigi and Princess Peach is Mario's girlfriend.`,

    `Mario protects Mushroom Kingdom from the evil Bowser and his minions of Koopa Troopers.`,

    `Mario can jump really high, shoot fireballs, eat mushrooms, and collect coins.`,

    `Mario sometimes likes to say things like "It\'s-a me, Mario!", "Yeah, wah, yahoo!", "Okeedokee!", and "Here we goooo!", bot not always.`,

  ].join('\n')

});

4. Now add messages = messages.concat(chatHistory);

5. If there are any available messages, they will be included in the data that will eventually provide to OpenAI. Subsequently, we will incorporate our new messages into the conversation:

messages.push({

  role: 'user',

  content: `${newMessage}`,

});

6. Let us now request our new chat completion from OpenAI:

let completionResponse = await lib.openai.playground['@0.2.2'].chat.completions.create({

  model: `gpt-4`,

  messages,

  max_tokens: 1024,

  temperature: 0.5,

  top_p: 1,

  n: 1,

  presence_penalty: 0.25,

  frequency_penalty: 0.1

});

7. To simplify accessibility, we can assign the relevant section of the completion Response to a variable named Message using the following code:

let message = completionResponse.choices[0].message.content;

8. Next, let us update our stored acknowledgementMessage Discord message to include the response received from OpenAI:

await lib.discord.channels['@0.3.4'].messages.update({

  message_id: acknowledgementMessage.id,

  channel_id: `${context.params.event.channel_id}`,

  content: `${message}`,

});

9. Next, we need new messages for future by adding the following:

chatHistory.push(

  {

    role: 'user',

    content: `${newMessage}`

  },

  {

    role: 'assistant',

    content: `${message}`

  },

);

await lib.utils.kv['@0.1.16'].set({

  key: historyKey,

  value: chatHistory.slice(-historyLength),

  ttl: historyTTL,

});

Thats It! Your Character AI Discord bot interaction is done.

Wrapping Up

In conclusion, creating a Character AI Discord bot involves several key steps. By setting up a Discord account and bot application, linking it with Autocode, and integrating OpenAI for chat interaction, you can bring your favorite fictional character to life within the Discord platform.

With the proper setup and system message configuration, you can craft engaging and personalized responses that reflect the character’s personality and goals.

By following these guidelines, you will be well on your way to building an interactive and immersive Character AI Discord bot.

Frequently Asked Questions

1. Can I create multiple Character AI Discord bots using the same Discord account?

Yes, you can create multiple Character AI Discord bots using the same Discord account by setting up separate bot applications for each bot.

2. Is it necessary to have programming knowledge to make a Character AI Discord bot?

While some programming knowledge can be helpful, platforms like Autocode provide user-friendly interfaces that allow you to create character AI Discord bots without extensive coding experience.

3. Can I use any fictional character for my Character AI Discord bot?

Yes, you can choose any fictional character from your favorite TV show, video games, or movies to be the basis for your character AI Discord bot.

4. Do I need to have an OpenAI account to create a Character AI Discord bot?

Yes, you will need to have an OpenAI account in order to integrate their technology for chat interactions with your Character AI Discord bot.

5. Can I customize the responses and behavior of my Character AI Discord bot?

Yes, you can customize the responses and behavior of your Character AI Discord bot by configuring the system message, providing specific instructions, and incorporating character-specific details to shape the bot’s personality and interactions.

Smriti Razdan

Smriti started her journey by attaining a degree in computer applications, laying down the foundation of her love for everything AI and tech. Research and bringing the best for her readers is what drives her. Besides work, Smriti loves to indulge in reading undiscovered stories and books keep her going.

You may also like...

Leave a Reply