Skip to content

Commit 6e253be

Browse files
Fixes
1 parent 0f6f85c commit 6e253be

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

‎main.py‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,23 @@ async def on_ready():
105105
await TBotD.add_cog(tbdtools.TBDTools(TBotD, connection))
106106

107107

108-
async def grok(ctx):
108+
async def grok(message):
109109
answer = ""
110-
rng = random.randint(1, 100)
111-
if 1 <= rng < 40:
110+
rng = random.randint(0, 99)
111+
if 0 <= rng < 30:
112112
answer = "yeah"
113-
elif 40 <= rng < 80:
113+
elif 30 <= rng < 60:
114114
answer = "nah"
115+
elif 60 <= rng < 80:
116+
answer = await fetch_random_verse()
115117
else:
116118
answer = random.choice([
117119
"meditate upon it and become wiser",
118120
"hmmmmm yeah nah, mhmmm maybe, idk",
119121
"😏",
120122
"As a large language model I can't help you with this request.",
121123
])
122-
await ctx.reply(answer)
124+
await message.reply(answer)
123125

124126

125127
@TBotD.event
@@ -128,7 +130,7 @@ async def on_message(message):
128130
if message.author.bot:
129131
return
130132
if "grok is this true" in message.content.lower():
131-
await grok(ctx)
133+
await grok(message)
132134
if message.guild is None:
133135
return
134136
connection = TBotD.db_connection
@@ -316,7 +318,7 @@ async def bottle(ctx: commands.Context):
316318
async def bible(ctx: commands.Context):
317319
bl.log(bible, ctx)
318320
verse = await fetch_random_verse()
319-
ctx.reply(verse)
321+
await ctx.reply(verse)
320322

321323

322324
@TBotD.command()
@@ -377,7 +379,7 @@ async def fetch_random_verse() -> str:
377379
book = data.get("book", "Unknown Book")
378380
chapter = data.get("chapter", 0)
379381
verse = data.get("verse", 0)
380-
text = data.get("text", "The industrial revolution and its consequences have been a disaster for the human race.")
382+
text = data.get("text", "The industrial revolution and its consequences have been a disaster for the human race.").strip()
381383
answer = f"({book} {chapter}:{verse}) \"{text}\""
382384
except httpx.HTTPError as exc:
383385
bl.error_log(exc)

‎requirements.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ editdistance_s==1.0.0
1515
filelock==3.18.0
1616
frozenlist==1.6.0
1717
future==1.0.0
18+
httpx==0.28.1
1819
identify==2.6.12
1920
idna==3.10
2021
multidict==6.4.4

0 commit comments

Comments
 (0)