Skip to content

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Counting game #82

wants to merge 2 commits into from

Conversation

OpenSourceSimon
Copy link
Member

No description provided.

Base automatically changed from development to master January 25, 2024 16:56

def __init__(self, bot: OGIROID):
self.bot = bot
self.count = 1
Copy link
Member

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():
Copy link
Member

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}")
Copy link
Member

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]
Copy link
Member

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():
Copy link
Member

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("✅")
Copy link
Member

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!",
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo ;-;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants