-
-
Notifications
You must be signed in to change notification settings - Fork 13
Counting game #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Counting game #82
Conversation
|
||
def __init__(self, bot: OGIROID): | ||
self.bot = bot | ||
self.count = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont store state in memory. We have a database, use it
async for message in self.channel.history(limit=10): | ||
if message.author.bot: | ||
continue | ||
if message.content.isdigit(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip the message
return | ||
messages = await self.channel.history(limit=1).flatten() | ||
last_message = messages[1] | ||
print(f"{last_message.author.name}: {last_message.content}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove debug prints
if message.author.bot or not message.content.isdigit(): | ||
return | ||
messages = await self.channel.history(limit=1).flatten() | ||
last_message = messages[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just... use the message arg passed into the function
messages = await self.channel.history(limit=1).flatten() | ||
last_message = messages[1] | ||
print(f"{last_message.author.name}: {last_message.content}") | ||
if last_message.author == message.author and last_message.content.isdigit(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplicate isdigit calls
elif message.content == str(self.count): | ||
self.count += 1 | ||
# Add checkmark reaction | ||
await message.add_reaction("✅") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh- I would have this be set for a channel. If the content isn't a num. delete it. No reactions
if last_message.author == message.author and last_message.content.isdigit(): | ||
embed = Embed( | ||
title="Counting Game", | ||
description=f"{message.author.mention}, you can't do this alone!", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no reason to not support an author sending multiple consecutive msgs
) | ||
await self.channel.send(embed=embed) | ||
self.count = 1 | ||
# TODO Implement leaderboard with db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo ;-;
No description provided.