mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-12-08 10:22:31 -05:00
New command [!chat]
Now it's possible to chat with the cleverbot
This commit is contained in:
19
red.py
19
red.py
@@ -16,6 +16,7 @@ import aiohttp
|
||||
import traceback
|
||||
import re
|
||||
import youtube_dl
|
||||
import cleverbot3
|
||||
import os
|
||||
import asyncio
|
||||
import glob
|
||||
@@ -44,6 +45,7 @@ help = """**Commands list:**
|
||||
!roll [number] - Random number between 0 and [number]
|
||||
!gif [text] - GIF search
|
||||
!urban [text] - Search definitions in the urban dictionary
|
||||
!chat [text] - Chat with the Cleverbot
|
||||
!customcommands - Custom commands' list
|
||||
!addcom [command] [text] - Add a custom command
|
||||
!editcom [command] [text] - Edit a custom command
|
||||
@@ -202,6 +204,8 @@ async def on_message(message):
|
||||
await gif(message)
|
||||
elif message.content.startswith('!urban'):
|
||||
await urban(message)
|
||||
elif message.content.startswith('!chat'):
|
||||
await chat(message)
|
||||
elif message.content.startswith('!uptime'):
|
||||
await uptime(message)
|
||||
elif message.content.startswith('!avatar'):
|
||||
@@ -844,6 +848,21 @@ async def urban(message):
|
||||
else:
|
||||
await client.send_message(message.channel, "!urban [text]")
|
||||
|
||||
async def chat(message):
|
||||
msg = message.content.split()
|
||||
if len(msg) > 1:
|
||||
try:
|
||||
msg.remove(msg[0])
|
||||
msg = "+".join(msg)
|
||||
question = msg
|
||||
answer = cleverbot_client.ask(question)
|
||||
if msg != "":
|
||||
await client.send_message(message.channel, "{}: ".format(message.author.mention) + answer)
|
||||
except:
|
||||
await client.send_message(message.channel, "Error.")
|
||||
else:
|
||||
await client.send_message(message.channel, "!chat [text]")
|
||||
|
||||
async def gif(message):
|
||||
msg = message.content.split()
|
||||
if len(msg) > 1:
|
||||
|
||||
Reference in New Issue
Block a user