AI Zone Admin Forum Add your forum

NEWS: survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Noob question - how to connect RiverScript with

I’m a beginner with Python. I want to make a simple bot with RiverScript and connect it to Discord. How can I join these two libraries?


  [ # 1 ]


rs = RiveScript(utf8=True) # open rivescript; we can also change encoding if we want to use foreign language with special characters
rs.load_directory(”./brain”) # just a path to our brain directory

async def on_message(message):
  if not ( == client.user):  # Check to ensure the bot does not respond to its own messages
      if (message.mention_everyone == False):
        if (client.user.mentioned_in(message) or isinstance(,  # Check if the bot is mentioned or if the message is in DMs. Please note that the bot replies to private messages, you need to change this line if you want to use it on public channel
          async with  # Show that the bot is typing

                msg = message.content # this is important part from this point to the end of script, we join the way how RiveScript and Discord take input and give a response
                reply = rs.reply(“localuser”, msg)
                await asyncio.sleep(random.randint(0, 2)) # not necessary, it just a simulation that the bot is typing a message and it takes some random time


  login or register to react