ai-bot/aibot.py

25 lines
605 B
Python
Raw Normal View History

2021-05-21 11:47:19 +00:00
from textgenrnn import textgenrnn
import discord
from discord.ext import commands
import regex as re
textgen = textgenrnn('insert3_weights.hdf5')
client = commands.Bot(command_prefix='.')
@client.command()
async def aiquote(ctx):
try:
textgen.generate_to_file('insert3.txt', n=1)
with open("insert3.txt") as f:
quote = f.read()
await ctx.send(quote)
except:
textgen.generate_to_file('insert3.txt', n=1)
with open("insert3.txt") as f:
quote = f.read()
await ctx.send(quote)
2021-05-21 11:47:52 +00:00
client.run('BOTTOKEN')