master
Chloe Fontenot 🏳️‍⚧️ 2020-02-27 19:07:21 +07:00
parent 28974e050a
commit 2f2e74f13d
25 changed files with 222 additions and 443 deletions

Binary file not shown.

@ -1,321 +0,0 @@
Delivered-To: foley2431@gmail.com
Received: by 2002:a17:90a:62c9:0:0:0:0 with SMTP id k9csp2454751pjs;
Thu, 27 Jun 2019 12:38:59 -0700 (PDT)
X-Received: by 2002:a5d:8c81:: with SMTP id g1mr6741349ion.239.1561664339657;
Thu, 27 Jun 2019 12:38:59 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1561664339; cv=none;
d=google.com; s=arc-20160816;
b=xwzygQkNBl4RrUe3SLUOiKF7PZxhy8sP1WgDrmfbrfYM84V5UEaqNbp3NmvKeJzMwj
/T4ylHAy4x6+qe5E78c+Db+WyrCNwo7MLZgGUm16SXrO4lQRDV2hE2oRep34VzGbywbp
S3vYW2tvMRj2sBT4L+grmerBo4J4HO7bu3fBrCth8xDwgVMFcDWKgEDmJqMTSDcti6Zt
TSiKIQtoLWeoB0w6TC+Xnxx+N3qxBaGStsJ217Atz9mbwF5gy7pQV5ZIlTbFfclgc5pt
bPjqQgr+aLcVpzKRlNNkz1jOlQrhu+Zxkhv1AFBPHrV4ofO7Lrwkp5by0HRj2z9AX+qE
z68Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:dkim-signature;
bh=nYbTDDD7FDOcAyeQOYg4aeTL1X63lWkIu4z5s6n/X8M=;
b=BdTBGL/9qyt1R2BsTWA/mSyXmYOWajowJVGQv9paSMx3pmpM3FpYdtQLFSi8vFVBjN
OTA6E6C5DQKxPgrWwAzDD21CoAJtlbVY08b6W4Sy0XU7Oj281/Yufi/DVt0xOVaPAqLd
ASYBVOIvzEFHw8OYouCGmEcEEAYyFxcXuzjVJG9DH6GZrju6ezCjhoVsPZX0pbVn8PGE
wTe2dLrWxw9h6wuTx+KDuXFRuaDy05+naA++h6p6XQSbZDP+Vu7AFKGgF2gBzq9spB67
R449QrBQsLbKy8zB2XTjVzrfZyHRpTgEmwjvzbOwlNiqikMLnSmw+9O3k7UOWr1PFgtH
YtCw==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@pediatrictlc-com.20150623.gappssmtp.com header.s=20150623 header.b=RWAkpuKx;
spf=pass (google.com: domain of allison@pediatrictlc.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=allison@pediatrictlc.com
Return-Path: <allison@pediatrictlc.com>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
by mx.google.com with SMTPS id h73sor2480973iof.22.2019.06.27.12.38.59
for <foley2431@gmail.com>
(Google Transport Security);
Thu, 27 Jun 2019 12:38:59 -0700 (PDT)
Received-SPF: pass (google.com: domain of allison@pediatrictlc.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41;
Authentication-Results: mx.google.com;
dkim=pass header.i=@pediatrictlc-com.20150623.gappssmtp.com header.s=20150623 header.b=RWAkpuKx;
spf=pass (google.com: domain of allison@pediatrictlc.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=allison@pediatrictlc.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=pediatrictlc-com.20150623.gappssmtp.com; s=20150623;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to;
bh=nYbTDDD7FDOcAyeQOYg4aeTL1X63lWkIu4z5s6n/X8M=;
b=RWAkpuKxnJg6AohdfEJv/tzlDQOwcq0wZECjd1hFreSIf+60mbeCCKkxqotM9Lg+sE
VWYxDCr7091xAXadjxloW/QWmoD3GOU4Tu4heSfooObaiicb7aYmY6dlXVjSCdJEsDxd
4mr/idEDnQIY1qppCnDDpSpaiA08Me7aIjU4CBIRWMVRH25vWWGYjo3j/kRslTKqSphs
imdHq0vum0BeC+C9Yt8gqJoL51wHCf8hggArH1oHgdToH9eYA2jQB0DG7FTW7zMutalA
UVn/l3B4rR6dOGKbmqo7BXz2mbjl74dEDpEC/9yU4TaY3I40T94EC8CYvHwzr/7r1kEI
Z5EQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to;
bh=nYbTDDD7FDOcAyeQOYg4aeTL1X63lWkIu4z5s6n/X8M=;
b=dk44IpPiycZmUEXFojs8OUTzsG8QOkHUCD6O+osQaBrUCYRO81FkosO+YWH2ArqgMg
QVSV9kqBr73jeEIC1wLaYPEU9XYs3MIr29B7VRJFUe6A6mUiH48OyekwGvrsL4EI68A8
cvGO8Pnp5dqiBXMOLofRRZsmikX5XkymHI7S9JuSGxaNT7afgS2IzlcWKI+Qsr6Py4dP
XU5ftImgffmaE3pE26UP8Kp3/QUK7xjjjhxo1DnCThFqiez2qtp65mSWvmH0kdOqq5kO
Z3yf2LZdmNyJobmlQBZRu50yNH25WoPHoXO0tZBJ+zw3lvOztD0S2i2v4D9APx48wWZh
PL6A==
X-Gm-Message-State: APjAAAVQ8Du7W67tJzbWI4CEGdZbTiifWElaj6X90wzWIW+SgV03Sw1w
lDVmGKaNgxECarZphrJ8BjA1nSFD4iDlB6FqsBa91Fwy
X-Google-Smtp-Source: APXvYqwBIap+WFhQUS6PQI4MjFopvdAdUzZTvgT6LsgOFDvc7GvdJiPZMbjWw/nw0MMc8+pVW8ODUXrfuDgx7nYKMPs=
X-Received: by 2002:a6b:6f0e:: with SMTP id k14mr6492400ioc.257.1561664338861;
Thu, 27 Jun 2019 12:38:58 -0700 (PDT)
MIME-Version: 1.0
References: <CAKC1GZMw27BuUN8oXwD2TvbOH3BW4EfDnz_ATZrX1phXk6Z0yg@mail.gmail.com>
<BD8BCA5E-FACB-45F8-8AF7-94EEF2371B19@pediatrictlc.com> <CAKC1GZMJMe92ftWbG1cpOyzOvZPmYkG6BtwYz2XWOvzM7_SH6A@mail.gmail.com>
In-Reply-To: <CAKC1GZMJMe92ftWbG1cpOyzOvZPmYkG6BtwYz2XWOvzM7_SH6A@mail.gmail.com>
From: Allison LeBouef <allison@pediatrictlc.com>
Date: Thu, 27 Jun 2019 14:38:46 -0500
Message-ID: <CAEuKE+65LdbHaTHnXVXb5ZK6XLsHQgqxT1QSdQh=Zm2m6dDqNA@mail.gmail.com>
Subject: Fwd: programming project
To: foley2431@gmail.com
Content-Type: multipart/alternative; boundary="0000000000002d3380058c535034"
--0000000000002d3380058c535034
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
---------- Forwarded message ---------
From: Andy LeGoullon <andylegoullon@gmail.com>
Date: Thu, Jun 20, 2019 at 12:14 AM
Subject: Re: programming project
To: Allison LeBouef <allison@pediatrictlc.com>
Here's the MadLibs project I give to my students. If Caleb wants to do this
project, have him do as much as he can on his own and then he can email me
with questions when he gets stuck. If he'd rather do some other project
that he thinks up, I could help him with that too.
Andy
Programming Project: MadLibs
1.
Write a MadLibs story containing 10 or so prompts (words you will ask
the user to enter, for example a noun, a country, a snack food, etc). Th=
e
story can be about anything you want: How to catch a fish, how to bake a
cake, what happens during a trip to Disney World, etc.
2.
Make a file called madlibs.py. This file will contain all the python
code to play your Madlibs. Add code to this file that does the following=
:
1.
Asks the first prompt, for example, "Enter the name of a vegetable"
2.
Store the user's entered word in a variable.
3.
Repeat these two tasks for all the remaining prompts.
4.
Print out the completed MadLibs story, replacing the prompts with the
words stored in the variables.
3.
Run your program and make sure it works correctly.
On Fri, Jun 14, 2019 at 9:48 AM Allison LeBouef <allison@pediatrictlc.com>
wrote:
> I love Madlibs! I like the idea of getting him to formulate the questions
> he needs to ask too. Let=E2=80=99s try it and see what happens! Thanks so=
much for
> helping me with this
> Allison
>
> Sent from my iPhone
>
> > On Jun 14, 2019, at 8:55 AM, Andy LeGoullon <andylegoullon@gmail.com>
> wrote:
> >
> > Are you familiar with Madlibs? I was thinking of having Caleb make a
> computer program version of Madlibs as his first project. It's more of an
> intermediate level project, but not impossible for someone starting out a=
nd
> it sounds like he's looking for a challenge. I can give you the project
> details if you think this would work out.
> >
> > He would definitely need some assistance on it at times, but it would
> give him good experience asking for help. I could help him out via
> email/phone. Or I can come in if he is getting very frustrated. Anna know=
s
> Python and may also be willing to help.
> >
> > Andy
>
--=20
Allison LeBouef, LOTR/ OT supervisor
Pediatric Therapy and Learning Center, LLC
108 Energy Pkwy
Lafayette, LA 70508
(337)504-4244
fax (337)706-7612
www.pediatrictlc.com
*Important Confidentiality Information:*
The information contained in this transmission may contain privileged and
confidential information, including patient information protected by
federal and state privacy laws. It is intended only for the use of the
person(s) named above. If you are not the intended recipient, any review,
dissemination, distribution, or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender by calling 337-504-4244 <(337)%20504-4244>. Feel free to leave
a voice message stating the sender and the subject line. Please destroy all
copies of the original message.
Clients: Please note that this is not an encrypted email which means that
the e-mail and any information it contains could be unknowingly
intercepted. Please consider this in all future correspondence.
--0000000000002d3380058c535034
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">---------- Forwarded message ---------<br>From: <strong cla=
ss=3D"gmail_sendername" dir=3D"auto">Andy LeGoullon</strong> <span dir=3D"a=
uto">&lt;<a href=3D"mailto:andylegoullon@gmail.com">andylegoullon@gmail.com=
</a>&gt;</span><br>Date: Thu, Jun 20, 2019 at 12:14 AM<br>Subject: Re: prog=
ramming project<br>To: Allison LeBouef &lt;<a href=3D"mailto:allison@pediat=
rictlc.com">allison@pediatrictlc.com</a>&gt;<br></div><br><br><div dir=3D"l=
tr">Here&#39;s the MadLibs project I give to my students. If Caleb wants to=
do this project, have him do as much as he can on his own and then he can =
email me with questions when he gets stuck. If he&#39;d rather do some othe=
r project that he thinks up, I could help him with that too.=C2=A0<div><br>=
</div><div>Andy</div><div><br></div><div><span id=3D"m_-3611317769460724002=
gmail-docs-internal-guid-61d5ccb3-7fff-4947-19e4-7ad848c11bb7"><p dir=3D"lt=
r" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;text-align:ce=
nter"><span style=3D"font-size:11pt;font-family:Arial;color:rgb(0,0,0);back=
ground-color:transparent;font-weight:700;font-variant-numeric:normal;font-v=
ariant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">Prog=
ramming Project: MadLibs</span></p><br><ol style=3D"margin-top:0pt;margin-b=
ottom:0pt"><li dir=3D"ltr" style=3D"list-style-type:decimal;font-size:10pt;=
font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-varian=
t-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;whi=
te-space:pre-wrap"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;=
margin-bottom:0pt"><span style=3D"font-size:10pt;background-color:transpare=
nt;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-alig=
n:baseline;white-space:pre-wrap">Write a MadLibs story containing 10 or so =
prompts (words you will ask the user to enter, for example a noun, a countr=
y, a snack food, etc). The story can be about anything you want: How to cat=
ch a fish, how to bake a cake, what happens during a trip to Disney World, =
etc.</span></p></li><li dir=3D"ltr" style=3D"list-style-type:decimal;font-s=
ize:10pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;fo=
nt-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:bas=
eline;white-space:pre-wrap"><p dir=3D"ltr" style=3D"line-height:1.38;margin=
-top:0pt;margin-bottom:0pt"><span style=3D"font-size:10pt;background-color:=
transparent;font-variant-numeric:normal;font-variant-east-asian:normal;vert=
ical-align:baseline;white-space:pre-wrap">Make a file called </span><span s=
tyle=3D"font-size:10pt;background-color:transparent;font-weight:700;font-va=
riant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline=
;white-space:pre-wrap">madlibs.py</span><span style=3D"font-size:10pt;backg=
round-color:transparent;font-variant-numeric:normal;font-variant-east-asian=
:normal;vertical-align:baseline;white-space:pre-wrap">. This file will cont=
ain all the python code to play your Madlibs. Add code to this file that do=
es the following:</span></p></li><ol style=3D"margin-top:0pt;margin-bottom:=
0pt"><li dir=3D"ltr" style=3D"list-style-type:lower-alpha;font-size:10pt;fo=
nt-family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-=
numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;white=
-space:pre-wrap"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;ma=
rgin-bottom:0pt"><span style=3D"font-size:10pt;background-color:transparent=
;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:=
baseline;white-space:pre-wrap">Asks the first prompt, for example, &quot;En=
ter the name of a vegetable&quot;</span></p></li><li dir=3D"ltr" style=3D"l=
ist-style-type:lower-alpha;font-size:10pt;font-family:Arial;color:rgb(0,0,0=
);background-color:transparent;font-variant-numeric:normal;font-variant-eas=
t-asian:normal;vertical-align:baseline;white-space:pre-wrap"><p dir=3D"ltr"=
style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style=3D=
"font-size:10pt;background-color:transparent;font-variant-numeric:normal;fo=
nt-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap">=
Store the user&#39;s entered word in a variable.</span></p></li><li dir=3D"=
ltr" style=3D"list-style-type:lower-alpha;font-size:10pt;font-family:Arial;=
color:rgb(0,0,0);background-color:transparent;font-variant-numeric:normal;f=
ont-variant-east-asian:normal;vertical-align:baseline;white-space:pre-wrap"=
><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"=
><span style=3D"font-size:10pt;background-color:transparent;font-variant-nu=
meric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-s=
pace:pre-wrap">Repeat these two tasks for all the remaining prompts.</span>=
</p></li><li dir=3D"ltr" style=3D"list-style-type:lower-alpha;font-size:10p=
t;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-vari=
ant-numeric:normal;font-variant-east-asian:normal;vertical-align:baseline;w=
hite-space:pre-wrap"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0p=
t;margin-bottom:0pt"><span style=3D"font-size:10pt;background-color:transpa=
rent;font-variant-numeric:normal;font-variant-east-asian:normal;vertical-al=
ign:baseline;white-space:pre-wrap">Print out the completed MadLibs story, r=
eplacing the prompts with the words stored in the variables.</span></p></li=
></ol><li dir=3D"ltr" style=3D"list-style-type:decimal;font-size:10pt;font-=
family:Arial;color:rgb(0,0,0);background-color:transparent;font-variant-num=
eric:normal;font-variant-east-asian:normal;vertical-align:baseline;white-sp=
ace:pre-wrap"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margi=
n-bottom:0pt"><span style=3D"font-size:10pt;background-color:transparent;fo=
nt-variant-numeric:normal;font-variant-east-asian:normal;vertical-align:bas=
eline;white-space:pre-wrap">Run your program and make sure it works correct=
ly.</span></p></li></ol></span></div><div><br></div></div><br><div class=3D=
"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Jun 14, 2019 at=
9:48 AM Allison LeBouef &lt;<a href=3D"mailto:allison@pediatrictlc.com" ta=
rget=3D"_blank">allison@pediatrictlc.com</a>&gt; wrote:<br></div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex">I love Madlibs! I like the idea of =
getting him to formulate the questions he needs to ask too. Let=E2=80=99s t=
ry it and see what happens! Thanks so much for helping me with this<br>
Allison<br>
<br>
Sent from my iPhone<br>
<br>
&gt; On Jun 14, 2019, at 8:55 AM, Andy LeGoullon &lt;<a href=3D"mailto:andy=
legoullon@gmail.com" target=3D"_blank">andylegoullon@gmail.com</a>&gt; wrot=
e:<br>
&gt; <br>
&gt; Are you familiar with Madlibs? I was thinking of having Caleb make a c=
omputer program version of Madlibs as his first project. It&#39;s more of a=
n intermediate level project, but not impossible for someone starting out a=
nd it sounds like he&#39;s looking for a challenge. I can give you the proj=
ect details if you think this would work out.<br>
&gt; <br>
&gt; He would definitely need some assistance on it at times, but it would =
give him good experience asking for help. I could help him out via email/ph=
one. Or I can come in if he is getting very frustrated. Anna knows Python a=
nd may also be willing to help. <br>
&gt; <br>
&gt; Andy<br>
</blockquote></div>
</div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr" class=3D"gma=
il_signature" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div=
dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div><span style=3D"font-siz=
e:12.8px">Allison LeBouef, LOTR/ OT supervisor</span><br></div>
<div>Pediatric Therapy and Learning Center, LLC</div>
<div>108 Energy Pkwy</div>
<div>Lafayette, LA=C2=A0 70508</div><div>(337)504-4244</div><div>fax (337)7=
06-7612</div><div><a href=3D"http://www.pediatrictlc.com" target=3D"_blank"=
>www.pediatrictlc.com</a></div><div><br></div><div><p style=3D"font-family:=
arial,&quot;san serif&quot;;font-size:12.8px"><strong>Important Confidentia=
lity Information:</strong></p><p style=3D"font-family:arial,&quot;san serif=
&quot;;font-size:12.8px">The information contained in this transmission may=
contain privileged and confidential information, including patient informa=
tion protected by federal and state privacy laws. It is intended only for t=
he use of the person(s) named above. If you are not the intended recipient,=
any review, dissemination, distribution, or duplication of this communicat=
ion is strictly prohibited. If you are not the intended recipient, please c=
ontact the sender by calling=C2=A0<a href=3D"tel:(337)%20504-4244" value=3D=
"+13375044244" style=3D"color:rgb(17,85,204)" target=3D"_blank">337-504-424=
4</a>.=C2=A0 Feel free to leave a voice message stating the sender and the =
subject line. Please destroy all copies of the original message.</p><p styl=
e=3D"font-family:arial,&quot;san serif&quot;;font-size:12.8px">Clients: Ple=
ase note that this is not an encrypted email which means that the e-mail an=
d any information it contains could be unknowingly intercepted.=C2=A0 Pleas=
e consider this in all future correspondence.=C2=A0</p></div></div></div></=
div></div></div></div></div>
--0000000000002d3380058c535034--

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -1,8 +1,10 @@
#!/usr/bin/python
# Toggle me for debugging
debug = 1
# Displays warning message
testing = 0
# Import the libraries we will use
#from mega import Mega
from datetime import datetime
from gtts import gTTS
import discord
@ -11,142 +13,200 @@ import sys
import random
import os
import asyncio
import ffmpeg
#import talkey
async def gameLoop():
# Set bot presence
await client.change_presence(activity=discord.Game(name='madlibs.py'))
# Introduce yourself
channel = client.get_channel(656233549837631508)
await channel.send("**<<madlibsDiscord.py - Written by Caleb Fontenot>>**")
await channel.send("Initial project started on **July 13, 2019**")
await channel.send("Discord Bot started on **December 16, 2019**")
# Notify if verbose
if debug == 1:
await channel.send("Debug mode is enabled! Being verbose!")
# 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
storyContentStr = []
storyNameStr = []
# Alright, let's get the data from stories.txt
i = 1
f = open('stories.txt', 'r')
for line in f.readlines():
if i % 2 == 0 :
storyContent = line
storyContentStr.append(storyContent)
else:
storyName = line
storyNameStr.append(storyName)
i+=1
f.close()
await channel.send(storyNameStr)
# Print current story title, but remove the brackets first
filteredTitle = re.findall(r'<(.*?)>', storyNameStr[story-1])
# print the first result
await channel.send("Current story title is "+'"'+str(filteredTitle[0])+'"'+'\n')
#Init tts, and connect voice to channel, hackily reinit connection if broken
voiceChannel = client.get_channel(682688245964079127)
voice = await voiceChannel.connect()
if voice.is_connected() == True:
await voice.disconnect()
voice = await voiceChannel.connect()
# Set bot presence
await client.change_presence(activity=discord.Game(name='madlibs.py'))
# Introduce yourself
channel = client.get_channel(656233549837631508)
await channel.send("**<<madlibsDiscord.py <:python:656239601723113472> - Written by Caleb Fontenot>>**")
await channel.send("Initial project started on **July 13, 2019**")
await channel.send("Discord Bot started on **December 16, 2019**")
# Notify if verbose
if debug == 1:
await channel.send("Debug mode is enabled! Being verbose!")
# 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
storyContentStr = []
storyNameStr = []
# Alright, let's get the data from stories.txt
i = 1
f = open('stories.txt', 'r')
for line in f.readlines():
if i % 2 == 0 :
storyContent = line
storyContentStr.append(storyContent)
else:
storyName = line
storyNameStr.append(storyName)
i+=1
f.close()
await channel.send(storyNameStr)
# Print current story title, but remove the brackets first
filteredTitle = re.findall(r'<(.*?)>', storyNameStr[story-1])
# print the first result
await channel.send("Current story title is "+'"'+str(filteredTitle[0])+'"'+'\n')
# Alright, now onto the tricky part. We need to filter out all of the bracketed words in stories.txt, putting them into a list, replacing them with incremental strings. We also need to count how many there are for later.
# Pull all of the items with the <> brackets
filtered = re.findall(r'<(.*?)>', storyContentStr[story-1])
# We got them!
if debug == 1:
await channel.send(str(filtered))
# Now we need to count them
replacedNumber = len(filtered)
# Run a loop to get the words
replaceList = []
#replaceList =['', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']
replaceList.append("")
await channel.send(str("Type a noun, verb, adjective, or adverb depending on what it asks you, followed by enter."))
for loopCount in range(replacedNumber):
#Wait for user to reply
await channel.send("Give me a(n) "+"**"+str(filtered[loopCount])+"**"+": ")
raw_message = await client.wait_for('message')
replaceVar = raw_message.content
print("You gave me: "+replaceVar)
replaceList.append(replaceVar)
print(replaceList)
filtered = re.findall(r'<(.*?)>', storyContentStr[story-1])
# We got them!
if debug == 1:
await channel.send(str(filtered))
# Now we need to count them
replacedNumber = len(filtered)
# Run a loop to get the words
replaceList = []
#replaceList =['', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24']
replaceList.append("")
await channel.send(str("Type a noun, verb, adjective, or adverb depending on what it asks you, followed by enter."))
for loopCount in range(replacedNumber):
#Wait for user to reply
await channel.send("Give me a(n) "+"**"+str(filtered[loopCount])+"**"+": ")
# Push text to gTTS and save it to a file
tts = gTTS(text="Give me a(n) "+str(filtered[loopCount])+": ")
os.system("rm badCurrentTTS.mp3")
os.system("rm currentTTS.mp3")
tts.save("badCurrentTTS.mp3")
# gTTS is stupid and gives us a file that discord.py doesn't understand, so we have to convert it
(
ffmpeg
.input('badCurrentTTS.mp3')
.output('currentTTS.mp3', audio_bitrate=48000, format='wav', sample_fmt='s16', ac='2')
.run()
)
if voice.is_playing() == True:
print("Audio is playing! Stopping playback!"+'\n')
voice.stop()
print("Attempting to play audio"+'\n')
voice.play(discord.FFmpegPCMAudio("currentTTS.mp3"))
raw_message = await client.wait_for('message')
replaceVar = raw_message.content
print("You gave me: "+replaceVar)
replaceList.append(replaceVar)
print(replaceList)
# Run a loop to replace the words
await channel.send("Replacing Words...")
# Split the Story Content into a list
storyContentList = re.split(r'<.*?>', storyContentStr[story-1])
# Count the items in the list
storyContentCount = len(storyContentList)
x = 0
for loopCount in range(storyContentCount):
#print(storyContentList[loopCount])
storyContentList.insert(x, replaceList[loopCount])
x = x+2
# To get colored words for our output, we need to add the appropiate commands to our variable.
x = 0
await channel.send("Replacing Words...")
# Split the Story Content into a list
storyContentList = re.split(r'<.*?>', storyContentStr[story-1])
# Count the items in the list
storyContentCount = len(storyContentList)
x = 0
for loopCount in range(storyContentCount):
#print(storyContentList[loopCount])
storyContentList.insert(x, replaceList[loopCount])
x = x+2
# To get colored words for our output, we need to add the appropiate commands to our variable.
x = 0
# Merge lists into a string
generatedStory = ""
generatedStory = generatedStory.join(storyContentList)
# Merge lists into a string
generatedStory = ""
generatedStory = generatedStory.join(storyContentList)
# Determine file name for file output
now = datetime.now()
currentDate = now.strftime("%d-%m-%Y-%H:%M:%S")
saveFile = 'saved stories/generatedStory-'+currentDate
# Send Story to Discord
await channel.send(generatedStory)
#exit()
#Alright! We're done! Let's save the story to a file
now = datetime.now()
currentDate = now.strftime("%d-%m-%Y-%H:%M:%S")
saveFile = 'saved stories/generatedStory-'+currentDate
if os.path.exists("saved stories"):
pass
else:
os.system("mkdir \"saved stories\"")
await channel.send(generatedStory)
await channel.send("Processing TTS, please wait!")
tts = gTTS(text=generatedStory+"This story was generated by Caleb Fontenot's MadLibs.py", lang='en')
os.system("rm badCurrentStory.mp3")
tts.save("badCurrentStory.mp3")
# gTTS is stupid and gives us a file that discord.py doesn't understand, so we have to convert it
(
ffmpeg
.input('badCurrentStory.mp3')
.output(saveFile+'.mp3', audio_bitrate=48000, format='wav', sample_fmt='s16', ac='2')
.run()
)
if voice.is_playing() == True:
print("Audio is playing! Stopping playback!"+'\n')
voice.stop()
print("Attempting to play audio"+'\n')
voice.play(discord.FFmpegPCMAudio(saveFile+".mp3"))
print("Saving story to .txt file")
await channel.send("Saving story to .txt file")
async with channel.typing():
file = open(saveFile+'.txt', 'w+')
line_offset = []
offset = 0
for line in file:
line_offset.append(offset)
offset += len(line)
file.seek(0)
file.write(filteredTitle[0]+'\n'+'\n')
file.write(generatedStory)
file.write('\n'+"Generated by Caleb Fontenot\'s madlibs.py")
file.close()
#Send generated txt file to Discord
await channel.send("Sending .txt file...")
discordFile = discord.File(saveFile+'.txt', filename="generatedStory.txt")
await channel.send(file=discordFile)
#exit()
#Alright! We're done! Let's save the story to a file
if os.path.exists("saved stories"):
pass
else:
os.system("mkdir \"saved stories\"")
print("Saving story to .txt file")
await channel.send("Saving story to .txt file")
async with channel.typing():
file = open(saveFile+'.txt', 'w+')
line_offset = []
offset = 0
for line in file:
line_offset.append(offset)
offset += len(line)
file.seek(0)
file.write(filteredTitle[0]+'\n'+'\n')
file.write(generatedStory)
file.write('\n'+"Generated by Caleb Fontenot\'s madlibs.py")
file.close()
#Send generated .txt file to Discord
await channel.send("Sending .txt file...")
discordFile = discord.File(saveFile+'.txt', filename="generatedStory.txt")
await channel.send(file=discordFile)
#Send generated .mp3 file to Discord
#If file is above 8 MB, upload it to MEGA
mp3File = saveFile+'.mp3'
def file_size(mp3File):
statinfo = os.stat(mp3File)
return statinfo.st_size
echo("MP3 is "+file_size+" bytes.")
await channel.send("MP3 is "+file_size+" bytes."
if int(file_size) <= int(8389999):
# File is over 8 MiB! This will fail if we send the file corrected for transmission via Discord's voice chat. Let's send the original instead.
discordFile = discord.File(badCurrentStory.mp3, filename=saveFile+'.mp3')
await channel.send(file=discordFile)
discordFile = discord.File(saveFile+'.mp3', filename=saveFile+'.mp3')
await channel.send(file=discordFile)
#Setup Discord functions and announce on discord that we are ready
class MyClient(discord.Client):
async def on_ready(self):
print('Logged on as', self.user)
channel = client.get_channel(656233549837631508)
await channel.send("madlibs.py - Discord Edition has successfully connected!")
await channel.send("Run `mad!start` to start a a game")
print("Ready!")
async def on_message(self, message, pass_context=True):
if message.content == 'mad!start':
channel = client.get_channel(656233549837631508)
await gameLoop()
await channel.send("Done!")
async def on_ready(self):
print('Logged on as', self.user)
channel = client.get_channel(656233549837631508)
await channel.send("madlibs.py - Discord Edition has successfully connected!")
if testing == 1:
await channel.send("This bot is currently being worked on! Please don't start a game!")
await channel.send("Run `mad!start` to start a a game")
print("Ready!")
async def on_message(self, message, pass_context=True):
if message.content == 'mad!start':
channel = client.get_channel(656233549837631508)
await gameLoop()
await channel.send("Done!")
await voice.disconnect()
#Run main Game loop
# The Discord bot ID isn't stored in this script for security reasons, so we have to go get it

@ -0,0 +1,5 @@
AMC Cinemas Pre-Show Policy
Thank you for choosing AMC Cinemas. Where we make movie moments AMC dasf. Your safety is sadfasdfdsf to us, so remember, keep a dsafas on your valuables. Be sure to report any sdafasdf behavior. And please take a moment to find any emergency exits near you. Make sure to stock up on kyffjhgfjhg and hgkfjhgfgjf at the concessions bar. Enjoy your movie, ,jhgkhgkjhkjhg and we thank you for choosing AMC Cinemas as your destination to watch that movie. Please, silence your 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,5 @@
Awards Show
Welcome everyone to s and the s MadLib awards show. Here are the nominees for s. First, s. Next, s. And finally, s. And the winner is... s! s could not be here tonight so he recorded a message for us to see. Take a look. Winner: Hello all. Thank you, the fans, for voting. I really appreciate it. I am sorry I couldn't be there.
Generated by Caleb Fontenot's madlibs.py

@ -0,0 +1,5 @@
MadLib Gameshow
sdfg on down! You're the next contestant on sgdf's new gameshow, MadLib! Here's how it works. You will sgdf over a dsgf at a rate of dsgf mph. After you jump over that item, you will afsd over to the afsd sadf and press the fsa at the end. sfad time wins! Oh. I forgot to introduce our host. He's a safd person who can't wait to Give me a(n) **verb**: in to the show. Please welcome, fsad! Alright players, on your mark. Get set. sfad! Alright, here goes sdf on the first stage of the competition. And.. WOAH! He just sadf over the thing! That's gonna hurt him tommorow. But it'll be all worth it after he wins the grand prize of asdf dollars! Which he says will go towards sdaf. Very asdf investment, but it's his money! Here he comes around the second leg. AND WOAH, AGAIN HE LOOKS sdf ON NETWORK TELEVISION! This is what primetime is all about here on the network of fdssdfsdfsdf. And, he presses it! He finishes with a time of qewrqwerqwer. Will that be enough to win? Find out on when qwertyuiop will challenge him for the grand prize. For all of us here at MadLib, good night everyone!
Generated by Caleb Fontenot's madlibs.py

@ -0,0 +1,5 @@
caleb wanted me to do a thing now it will commence
Once upon a time in the land of poiuytrewq, there was a lovely little chap called , but everyone just qwertyuiop to call him sdfasdfsadf. You see, he was the hero of the nearby city of sadfasdfsadfasdfasdf, and that made the mayor of the city he lived in, fd, very unhappy. So, in an act of asfd, he created his own asdf army to take over the world. Now sdaasfdsfadsafdsfad did not like this, so he sfadsdafasfdsafdsafdasfdasfdasdfasdfsadfsadf up to the main robot, which the mayor was in, and told him "sdfasfdasadfasfdsadfsdafs". The mayor, hearing those words, instantly surrendered and . He was then charged for 3 major acts of asdf.
Generated by Caleb Fontenot's madlibs.py

@ -0,0 +1,5 @@
Awards Show
Welcome everyone to Azerbaijani and the 1666 MadLib awards show. Here are the nominees for Bohemian Rhapsody for best Editing 10/10 yes good I love it good. First, James K. Polk. Next, Toby McGuire. And finally, Floopin. And the winner is... ! Not Robert Kubica could not be here tonight so he recorded a message for us to see. Take a look. Winner: Hello all. Thank you, the fans, for voting. I really appreciate it. I am sorry I couldn't be there.
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 hugging. Your safety is lime-green to us, so remember, keep a the third segment on your index finger on your valuables. Be sure to report any smooth behavior. And please take a moment to find any emergency exits near you. Make sure to stock up on IF ANYONE ELSE DRINKS A&W ROOT BEER I SWEAR TO JAH and food at the concessions bar. Enjoy your movie, Hot Fuz (2007) directed by Edgar Wright and we thank you for choosing AMC Cinemas as your destination to watch that movie. Please, silence your Sam Sung Galaxy smart Fridge 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,5 @@
MadLib Gameshow
ran on down! You're the next contestant on 's new gameshow, MadLib! Here's how it works. You will verb 2 over a https://youtu.be/CnUT2KIvtSM at a rate of 389,780 mph. After you jump over that item, you will over to the crashing Buggy Python Script and press the Scunderia Ferrari's Formula 1 strategy at the end. Give me a(n) **adjective**: time wins! Oh. I forgot to introduce our host. He's a fast person who can't wait to Give me a(n) **verb**: in to the show. Please welcome, that guy who's rookie this year! Alright players, on your mark. Get set. british people! Alright, here goes boy on the first stage of the competition. And.. WOAH! He just -ed over the thing! That's gonna hurt him tommorow. But it'll be all worth it after he wins the grand prize of 6,250,716 dollars! Which he says will go towards a. Very " investment, but it's his money! Here he comes around the second leg. AND WOAH, AGAIN HE LOOKS & ON NETWORK TELEVISION! This is what primetime is all about here on the network of no. And, he presses it! He finishes with a time of stop. Will that be enough to win? Find out on I didn't ask for this when no will challenge him for the grand prize. For all of us here at MadLib, good night everyone!
Generated by Caleb Fontenot's madlibs.py

@ -0,0 +1,5 @@
Three Little Pigs
Once upon a time, there were three who said that? pigs. One day, their mother said, "You are all grown up and must Why am I trapped in this room? on your own." So they left to Stop patronizing me their houses. The first little pig wanted only to Where am I? all day and quickly built his house out of What?. The second little pig wanted to Is this a sort of test? and Please stop all day so he What have I done to you to do this to me? his house with Where is my pudding?. The third It's right here pig knew the wolf lived nearby and worked hard to Oh, good his house out of Wait, why are my arms not moving. One day, the wolf knocked on the first pig's You're an amputee. "Let me in or I'll 🧠 your house down!" The pig didn't, so the wolf ah my nitro ran out rip down the . The wolf knocked on the second pig's <:thonk:519648775778598922>. "Let me in or I'll blow your <:ferrari_wheel:672633066417684510> down!" The pig didn't, so the wolf <:python:656239601723113472> down the house. Then the wolf knocked on the third pig's door. "Let me in or I'll blow your house down!" The little pig didn't, so the wolf a en past tense verb and ^^^^^^6.He could not blow the house down. All the pigs went to live in the There's a point at 7,000 RPMs where everything fades. The machine becomes weightless. It disappears. All that's left, a body moving through space, and time. house and they all do you like Ford V Ferrari? happily ever after.
Generated by Caleb Fontenot's madlibs.py

Binary file not shown.

Binary file not shown.