mirror of
https://github.com/supleed2/gondilinabot-python.git
synced 2024-12-22 13:35:48 +00:00
Sourcery Suggestions
This commit is contained in:
parent
87f3086c71
commit
8d868ebae4
26
app.py
26
app.py
|
@ -16,9 +16,9 @@ idleMessageCounter = 0
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print("Logged in as")
|
print("Logged in as")
|
||||||
print(bot.user.name + "#" + bot.user.discriminator)
|
print(f"{bot.user.name}#{bot.user.discriminator}")
|
||||||
print(bot.user.id)
|
print(bot.user.id)
|
||||||
print("Init Counter: " + str(counter))
|
print(f"Init Counter: {str(counter)}")
|
||||||
await bot.change_presence(
|
await bot.change_presence(
|
||||||
status=discord.Status.online, activity=discord.Game(name="with Godlina")
|
status=discord.Status.online, activity=discord.Game(name="with Godlina")
|
||||||
)
|
)
|
||||||
|
@ -36,7 +36,7 @@ async def on_message(message):
|
||||||
await bot.change_presence(
|
await bot.change_presence(
|
||||||
status=discord.Status.online,
|
status=discord.Status.online,
|
||||||
activity=discord.Game(
|
activity=discord.Game(
|
||||||
name="with Godlina [" + str(idleMessageCounter) + "]"
|
name=f"with Godlina [{idleMessageCounter}]"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
elif message.author.id == 581890740360052764:
|
elif message.author.id == 581890740360052764:
|
||||||
|
@ -44,7 +44,7 @@ async def on_message(message):
|
||||||
"(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1
|
"(^| )(I'M|IM|I AM|I'm|Im|I am|i'm|im|i am)( )", message.content, 1
|
||||||
)
|
)
|
||||||
if len(reply) > 1:
|
if len(reply) > 1:
|
||||||
print("Message from " + message.author.name + ": " + message.content)
|
print(f"Message from {message.author.name}: {message.content}")
|
||||||
print(
|
print(
|
||||||
"Reply: Length:"
|
"Reply: Length:"
|
||||||
+ str(len(reply))
|
+ str(len(reply))
|
||||||
|
@ -52,9 +52,9 @@ async def on_message(message):
|
||||||
+ reply[-1]
|
+ reply[-1]
|
||||||
+ "}"
|
+ "}"
|
||||||
)
|
)
|
||||||
await message.reply("Hi " + reply[-1] + ", I'm Dad")
|
await message.reply(f"Hi {reply[-1]}, I'm Dad")
|
||||||
print(
|
print(
|
||||||
"Replied unconditionally to " + message.author.name + " with Dad Joke"
|
f"Replied unconditionally to {message.author.name} with Dad Joke"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# TODO: Add detection for "genshin" and replace with "g*nshin"
|
# TODO: Add detection for "genshin" and replace with "g*nshin"
|
||||||
|
@ -63,7 +63,7 @@ async def on_message(message):
|
||||||
)
|
)
|
||||||
if len(reply) > 1:
|
if len(reply) > 1:
|
||||||
idleMessageCounter = 0
|
idleMessageCounter = 0
|
||||||
print("Message from " + message.author.name + ": " + message.content)
|
print(f"Message from {message.author.name}: {message.content}")
|
||||||
print(
|
print(
|
||||||
"Reply: Length:"
|
"Reply: Length:"
|
||||||
+ str(len(reply))
|
+ str(len(reply))
|
||||||
|
@ -73,18 +73,18 @@ async def on_message(message):
|
||||||
)
|
)
|
||||||
if counter > 0:
|
if counter > 0:
|
||||||
counter -= 1
|
counter -= 1
|
||||||
print("Cooldown: " + str(counter) + " messages")
|
print(f"Cooldown: {counter} messages")
|
||||||
else:
|
else:
|
||||||
counter = random.randrange(mincooldown, maxcooldown)
|
counter = random.randrange(mincooldown, maxcooldown)
|
||||||
await message.reply("Hi " + reply[-1] + ", I'm Dad")
|
await message.reply(f"Hi {reply[-1]}, I'm Dad")
|
||||||
print("Replied to " + message.author.name + " with Dad Joke")
|
print(f"Replied to {message.author.name} with Dad Joke")
|
||||||
else:
|
else:
|
||||||
idleMessageCounter += 1
|
idleMessageCounter += 1
|
||||||
if idleMessageCounter % 5 == 0:
|
if idleMessageCounter % 5 == 0:
|
||||||
await bot.change_presence(
|
await bot.change_presence(
|
||||||
status=discord.Status.online,
|
status=discord.Status.online,
|
||||||
activity=discord.Game(
|
activity=discord.Game(
|
||||||
name="with Godlina [" + str(idleMessageCounter) + "]"
|
name=f"with Godlina [{idleMessageCounter}]"
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -101,7 +101,5 @@ with open("secrets.yaml") as stream:
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
print(exc)
|
print(exc)
|
||||||
print("Secrets.yaml failed to load, exiting...")
|
print("Secrets.yaml failed to load, exiting...")
|
||||||
raise SystemExit
|
raise SystemExit from exc
|
||||||
|
|
||||||
|
|
||||||
bot.run(secrets["bottoken"])
|
bot.run(secrets["bottoken"])
|
||||||
|
|
Loading…
Reference in a new issue