An open API service indexing awesome lists of open source software.

https://github.com/trojaner/impostorbot

impersonate any Discord user's unique writing style
https://github.com/trojaner/impostorbot

bot chatgpt discord impostor rnn

Last synced: 8 months ago
JSON representation

impersonate any Discord user's unique writing style

Awesome Lists containing this project

README

          

# Discord Impostor Bot

This bot can impersonate any Discord user's unique writing style. It can generate text based on prompts or it can be completely random.

As this bot needs to save all channel messages when importing it cannot be a public bot for privacy reasons. You must self-host it to use it on your own servers.

This bot is the successor of the [MarkovBot](https://github.com/Trojaner/MarkovBot). The MarkovBot used markov chains for text prediction, which resulted in low quality results.
This bot uses a recurrent neural network (RNN) with Tensorflow.js instead. The RNN related code was generated by [ChatGPT](https://openai.com/blog/chatgpt/).

[This prompt](https://github.com/Trojaner/ImpostorBot/blob/master/misc/chatgpt-query.txt) was used to generate the RNN code.

## Required permissions / intents

The bot needs the "Message Content" intent as it must be able to grab new messages.
It also needs the following permissions:

- Read Messages/View Channels
- Send Messages
- Read Message History
- Webhooks for channels where it can auto-reply or impersonate users

## How to run

### Setting up the database

Run the migration.sql file inside the db folder. If you are not using postgresql create a similar table manually instead.

### Setting up the environment

Create an .env file in the project's root directory with the following content (or pass as environment variables):

```
DISCORD_CLIENT_TOKEN=""
CONNECTION_STRING="" # e.g. "postgres://postgres@localhost:5432/bot", see sequelizer documentation for more options
```

### Import messages

Import messages from your text channels. Run `/import ` to import messages from a channel.
The more messages you have, the better the results are. Avoid importing gibberish from e.g. #bot-commands channels.
Regardless of that the bot will try to filter out unparsable messages like links or messages that seem like bot commands.

**YOU SHOULD AVOID IMPORTING MESSAGES WHEN RUNNING THE BOT ON YOUR OWN COMPUTER. DISCORD WILL RATE-LIMIT YOUR IP ADDRESS FOR A FEW HOURS. YOU WILL NOT BE ABLE TO USE YOUR DISCORD UNTIL THE RATE LIMIT EXPIRES OR YOUR IP ADDRESS CHANGES.**

## Using the bot

### Impersonate Users

After importing the messages you can impersonate any user using the `/impersonate [prompt]` command.
The prompt parameter is optional and can include a few words that the generated message should start with.

## Todo:

- Dockerfile
- Periodic auto importing of messages
- Randomly reply as random user (to questions?)

## Credits:

[ChatGPT](https://openai.com/blog/chatgpt/) for the RNN code.
[GitHub Copilot](https://github.com/features/copilot) for being a helping hand.