Updated intents
This commit is contained in:
parent
b04a8e843a
commit
1909da53f3
@ -3,6 +3,7 @@ Alternative to "My AI", by Snapchat, but on Discord.
|
|||||||
## Installation Steps
|
## Installation Steps
|
||||||
### Preparing your environnement
|
### Preparing your environnement
|
||||||
- Create your Discord bot [here](https://discord.com/developers/applications)
|
- Create your Discord bot [here](https://discord.com/developers/applications)
|
||||||
|
- Enable **Members** and **Messages** intents.
|
||||||
- Create your OpenAI Developer Account [here](https://platform.openai.com)
|
- Create your OpenAI Developer Account [here](https://platform.openai.com)
|
||||||
### Setting up the bot
|
### Setting up the bot
|
||||||
1. Install Python >= 3.8.10
|
1. Install Python >= 3.8.10
|
||||||
|
5
main.py
5
main.py
@ -14,7 +14,9 @@ load_dotenv()
|
|||||||
openai.api_key = os.environ['OPENAI_API_KEY']
|
openai.api_key = os.environ['OPENAI_API_KEY']
|
||||||
db = sqlite3.connect('tokens.db')
|
db = sqlite3.connect('tokens.db')
|
||||||
typing = []
|
typing = []
|
||||||
intents = discord.Intents.all()
|
intents = discord.Intents.default()
|
||||||
|
intents.members = True
|
||||||
|
intents.dm_messages = True
|
||||||
|
|
||||||
class App(discord.Client):
|
class App(discord.Client):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -37,6 +39,7 @@ async def typing_loop():
|
|||||||
@app.event
|
@app.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print('We have logged in as {0.user}'.format(app))
|
print('We have logged in as {0.user}'.format(app))
|
||||||
|
await app.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="your direct messages!"))
|
||||||
typing_loop.start()
|
typing_loop.start()
|
||||||
|
|
||||||
encoding = tiktoken.get_encoding('cl100k_base')
|
encoding = tiktoken.get_encoding('cl100k_base')
|
||||||
|
Loading…
Reference in New Issue
Block a user