-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbot.py
33 lines (26 loc) · 882 Bytes
/
bot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import discord
from data.weapon import Character
from rasa_api import call_for
token = 'NjU1MzYxMDIwOTQ4MTE5NTUz.XfTA8g.q6S4VdyMalPmt-5CuH6o8L3OkOI'
client = discord.Client()
@client.event
async def on_ready():
print('Ready to talk to botsssss')
@client.event
async def on_message(message):
print(f"{message.author}, {message.content}")
message_info = call_for(message.content)
data = message_info['intent']['name']
if message.author == client.user:
return
# check confidence here
print(data)
if data == 'create_character':
Character.createCharacter()
return True
elif data == 'attack':
Character.attack()
return await message.channel.send('You attack with your weapon')
else:
return await message.channel.send(f'We will contact you for the query "{message.content}"')
client.run(token)