Removed the reliance on storyCount.txt

master
Chloe Fontenot 🏳️‍⚧️ 2020-08-24 14:22:37 +07:00
parent 2cd52b9e72
commit 624285717f
10 changed files with 33 additions and 12 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -21,7 +21,7 @@ import asyncio
from threading import Thread from threading import Thread
import ffmpeg import ffmpeg
#import talkey #import talkey
prefix = 'mad!'
tracemalloc.start() tracemalloc.start()
async def madlibsLoop(): async def madlibsLoop():
@ -44,15 +44,6 @@ async def madlibsLoop():
if debug == 1: if debug == 1:
await channel.send("Debug mode is enabled! Being verbose!") await channel.send("Debug mode is enabled! Being verbose!")
# Now on to business! # Now on to business!
# Load files
async with channel.typing():
f = open('storyCount.txt', 'r')
StoryCount = f.read()
IntStoryCount = int(StoryCount)
await channel.send("Detected "+str(IntStoryCount)+" stories")
# Randomly pick what story we will use
story = random.randint(1, IntStoryCount)
#Declare vars #Declare vars
storyContentStr = [] storyContentStr = []
storyNameStr = [] storyNameStr = []
@ -68,6 +59,14 @@ async def madlibsLoop():
storyNameStr.append(storyName) storyNameStr.append(storyName)
i+=1 i+=1
f.close() f.close()
# Load files
async with channel.typing():
#Count the number of lines in storyName, we use this to determine what story to use
print(storyName)
IntStoryCount = len(storyNameStr)
await channel.send("Detected "+str(IntStoryCount)+" stories")
# Randomly pick what story we will use
story = random.randint(1, IntStoryCount)
await channel.send(storyNameStr) await channel.send(storyNameStr)
# Print current story title, but remove the brackets first # Print current story title, but remove the brackets first
filteredTitle = re.findall(r'<(.*?)>', storyNameStr[story-1]) filteredTitle = re.findall(r'<(.*?)>', storyNameStr[story-1])
@ -111,7 +110,7 @@ async def madlibsLoop():
voice.stop() voice.stop()
print("Attempting to play audio"+'\n') print("Attempting to play audio"+'\n')
voice.play(discord.FFmpegPCMAudio("currentTTS.wav")) voice.play(discord.FFmpegPCMAudio("currentTTS.wav"))
message = await client.wait_for('message') message = await client.wait_for('message', check=lambda message: message.channel.id == activeChannel)
# , check=lambda messages: message.author.id == ctx.author.id and ctx.channel.id == message == ctx.message.id, timeout=30.0 # , check=lambda messages: message.author.id == ctx.author.id and ctx.channel.id == message == ctx.message.id, timeout=30.0
replaceVar = message.content replaceVar = message.content
print("You gave me: "+replaceVar) print("You gave me: "+replaceVar)
@ -201,6 +200,7 @@ async def madlibsLoop():
class MyClient(discord.Client): class MyClient(discord.Client):
async def on_ready(self): async def on_ready(self):
global prefix
#print(loop) #print(loop)
print('Logged on as', self.user) print('Logged on as', self.user)
channel = client.get_channel(656233549837631508) channel = client.get_channel(656233549837631508)
@ -217,6 +217,17 @@ class MyClient(discord.Client):
channel = client.get_channel(656233549837631508) channel = client.get_channel(656233549837631508)
await madlibsLoop() await madlibsLoop()
await channel.send("Done!") await channel.send("Done!")
"""
async def on_message(self, message, pass_context=True):
global prefix
if message.content == prefix+'cough':
voiceChannel = client.get_channel(690301271382556823)
voice = await voiceChannel.connect()
if voice.is_connected() == True:
await voice.disconnect()
voice = await voiceChannel.connect()
voice.play(discord.FFmpegPCMAudio("coughing.wav"))
"""
#Turn on message logging #Turn on message logging
""" """
async def on_message(self, message, pass_context=True): async def on_message(self, message, pass_context=True):
@ -281,7 +292,6 @@ BotID = f.read()
#os.system("rm badCurrentTTS.mp3") #os.system("rm badCurrentTTS.mp3")
#os.system("rm currentTTS.wav") #os.system("rm currentTTS.wav")
# Connect Bot To Discord and start running # Connect Bot To Discord and start running
client = MyClient() client = MyClient()
client.run(BotID) client.run(BotID)
exit() exit()

@ -0,0 +1,5 @@
caleb wanted me to do a thing now it will commence
Once upon a time in the land of Can I do one next?, there was a lovely little chap called Julie, but everyone just Cooked to call him Carrot. You see, he was the hero of the nearby city of New Delhi, and that made the mayor of the city he lived in, China Anne McClain, very unhappy. So, in an act of Cat, he created his own Dog army to take over the world. Now Eyes did not like this, so he Potatoed up to the main robot, which the mayor was in, and told him "I eat banana". The mayor, hearing those words, instantly surrendered and Mooed. He was then charged for 3 major acts of Tree.
Generated by Caleb Fontenot's madlibs.py

@ -0,0 +1,5 @@
AMC Cinemas Pre-Show Policy
Thank you for choosing AMC Cinemas. Where we make movie moments AMC asdfasdfasdfdasfasdf. Your safety is yes to us, so remember, keep a adsfdsf on your valuables. Be sure to report any ZXcZXCZXCZXC behavior. And please take a moment to find any emergency exits near you. Make sure to stock up on laksjdhflaksdfjhasdf and asdf;laskdfjas;dlfk at the concessions bar. Enjoy your movie, asdjkfhgasdfygs and we thank you for choosing AMC Cinemas as your destination to watch that movie. Please, silence your asdfasdf now and be quiet and courteous of your peers. And now, ladies and gentlemen, here are some special previews coming to an AMC near you.
Generated by Caleb Fontenot's madlibs.py

@ -0,0 +1 @@
'NTU5MTE1MDIwMzY2MjUwMDE1.XfaP_Q.kIx9CMEpzNUqOhXgfSUh-r_u0Fk'