commit 1bf3c32fd713b737ba9ae3844e03eda35714e832 Author: insert username here Date: Fri May 21 07:47:19 2021 -0400 Add files via upload diff --git a/aibot.py b/aibot.py new file mode 100644 index 0000000..fb467c6 --- /dev/null +++ b/aibot.py @@ -0,0 +1,24 @@ +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) + + +client.run('Nzk0MzgwMDQ5MzUxOTY2NzQy.X-5-Eg.5mYRMnHxHYqFQZKbbnY8cyTxOzQ') \ No newline at end of file diff --git a/aitrain.py b/aitrain.py new file mode 100644 index 0000000..c9e9ad5 --- /dev/null +++ b/aitrain.py @@ -0,0 +1,46 @@ +from textgenrnn import textgenrnn +import discord +from discord.ext import commands +import regex as re + +textgen = textgenrnn(name="insert3") +client = commands.Bot(command_prefix='.') +boton = 0 + +@client.event +async def on_message(message): + await client.process_commands(message) + urls = re.findall('http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',message.content.lower()) + if not message.attachments: + if boton == 1: + if message.content.lower().startswith("$"): + pass + elif urls: + pass + elif message.author.bot: + pass + elif message.content.lower().startswith("p!"): + pass + elif message.content.lower().startswith("—"): + pass + else: + print(message.clean_content) + train = open("train.txt", "a") + train.write(f"{message.clean_content} \n") + train.close() + +@client.command() +async def train(ctx): + if ctx.author.id == 666378959184855042: + global boton + boton = 1 + await ctx.send("I am now training what to say based on your messages") + +@client.command() +async def stopbot(ctx): + if ctx.author.id == 666378959184855042: + await ctx.send("data collection done, I will now log of discord and build an a.i") + textgen.train_from_file('train.txt', num_epochs=1) + + +client.run('Nzk0MzgwMDQ5MzUxOTY2NzQy.X-5-Eg.5mYRMnHxHYqFQZKbbnY8cyTxOzQ') \ No newline at end of file diff --git a/insert3_weights.hdf5 b/insert3_weights.hdf5 new file mode 100644 index 0000000..45d5eeb Binary files /dev/null and b/insert3_weights.hdf5 differ