python-discord / sir-lancebot

A Discord bot started as a community project for Hacktoberfest 2018, later evolved to an introductory project for aspiring new developers starting out with open source development.
MIT License
243 stars 241 forks source link

Reintroduce hangman multiplayer #872

Open Bluenix2 opened 3 years ago

Bluenix2 commented 3 years ago

Description

Following the removal in #871, hangman should be re-added again.

Reasoning

Quickly following its introduction it become apparent that hangman's multiplayer mode had some flaws. Most importantly, it meant that a whole channel was occupied.

Proposed Implementation

Multiplayer mode should be reintroduced using threads, this is also the reason that the issues are separated. As the Python bot doesn't quite yet receive messages in threads so threads have not yet been enabled.

The bot should open a thread on the hangman message and listen for messages in that thread, unless the command was invoked in a thread that is, at which point it will play like normal.

Would you like to implement this yourself?

lxnn commented 3 years ago

I'm not up to date on whether we are already using threads with Sir Lancebot. Is this issue currently blocked?

DMFriends commented 3 years ago

I'm not up to date on whether we are already using threads with Sir Lancebot. Is this issue currently blocked?

So, here's the thing: we can technically use threads manually, but that's not going to be very effective for this game, right? So what we are waiting on is the full release of d.py 2.0, after which we can upgrade the main Python bot so it can manage threads (there is a PR for it in the bot repo), and only after that could someone start working on this. So yes, you are right, this issue is pretty much blocked for now. Does that answer your question?

DMFriends commented 3 years ago

I have 2 alternative implementations that don't really require the use of threads.

  1. What we could do is, instead of opening threads when the multiplayer game command is run, (I'm not even sure if this is possible) unlock a special channel where anyone can join the person who ran the command. This one has some problems, which I'm not sure if it's obvious or not so I'll say it anyway. Other people could join the new channel and spam it.

  2. We could also do it like this: whenever someone runs the multiplayer game command, we could make it so that the bot sends an embed asking someone to accept the challenge using buttons, and once another player accepts, the person who ran the command and the person who accepted will get a special role which unlocks a channel just for the players, and then, when the game is over, the role is removed and the channel is locked again.

If no one accepts the challenge within a certain amount of time, let's say 5 minutes, then the challenge expires.

I personally like option 2 better. Please let me know what you guys think about this.

CC @Bluenix2 @Shom770 @ChrisLovering

Bluenix2 commented 3 years ago

I'm not up to date on whether we are already using threads with Sir Lancebot. Is this issue currently blocked?

Yes @lxnn we need to wait for Python bot's usage of discord.py to use threads anywhere. Even though Sir Lancebot does support threads.

I have 2 alternative implementations that don't really require the use of threads.

  1. What we could do is, instead of opening threads when the multiplayer game command is run, (I'm not even sure if this is possible) unlock a special channel where anyone can join the person who ran the command. This one has some problems, which I'm not sure if it's obvious or not so I'll say it anyway. Other people could join the new channel and spam it.
  2. We could also do it like this: whenever someone runs the multiplayer game command, we could make it so that the bot sends an embed asking someone to accept the challenge using buttons, and once another player accepts, the person who ran the command and the person who accepted will get a special role which unlocks a channel just for the players, and then, when the game is over, the role is removed and the channel is locked again.

If no one accepts the challenge within a certain amount of time, let's say 5 minutes, then the challenge expires.

I personally like #2 better. Please let me know what you guys think about this.

I would much rather we wait until we can use threads.

DMFriends commented 3 years ago

I'm not up to date on whether we are already using threads with Sir Lancebot. Is this issue currently blocked?

Yes @lxnn we need to wait for Python bot's usage of discord.py to use threads anywhere. Even though Sir Lancebot does support threads.

I have 2 alternative implementations that don't really require the use of threads.

  1. What we could do is, instead of opening threads when the multiplayer game command is run, (I'm not even sure if this is possible) unlock a special channel where anyone can join the person who ran the command. This one has some problems, which I'm not sure if it's obvious or not so I'll say it anyway. Other people could join the new channel and spam it.
  2. We could also do it like this: whenever someone runs the multiplayer game command, we could make it so that the bot sends an embed asking someone to accept the challenge using buttons, and once another player accepts, the person who ran the command and the person who accepted will get a special role which unlocks a channel just for the players, and then, when the game is over, the role is removed and the channel is locked again.

If no one accepts the challenge within a certain amount of time, let's say 5 minutes, then the challenge expires.

I personally like #2 better. Please let me know what you guys think about this.

I would much rather we wait until we can use threads.

Ok, I guess we can wait. Do you know approximately when dpy 2.0 will be released? @Bluenix2

Bluenix2 commented 3 years ago

It won't, discord.py has been archived and Python bot will be moved to the most recent commit and use that for the time being.

DMFriends commented 3 years ago

It won't, discord.py has been archived and Python bot will be moved to the most recent commit and use that for the time being.

What do you mean by "most recent commit"? Of dpy? And my guess is that commit does not include thread support, correct? If so, I'm curious to know how thread support will be added to the Python bot and when that will happen? @Bluenix2

Bluenix2 commented 3 years ago

Discord.py has been archived and Python bot (the same way Sir Lancebot does) install from the GitHub repository where there is thread support and support for interactions.

DMFriends commented 3 years ago

Discord.py has been archived and Python bot (the same way Sir Lancebot does) install from the GitHub repository where there is thread support and support for interactions.

So wait, you got me confused. Before you said we are still waiting on the thread support addition, but now it seems like you're saying the bots are supporting threads already? Please clarify @Bluenix2

Bluenix2 commented 3 years ago

Python bot doesn't use discord.py 2.0 yet.

DMFriends commented 3 years ago

Python bot doesn't use discord.py 2.0 yet.

Ok, thanks for clarifying.

DMFriends commented 2 years ago

Hey @Bluenix2, is this issue still stalled? I don't think I'll be able to work on it, but if it is no longer stalled you could switch the labels.

Bluenix2 commented 2 years ago

Threads are still not yet allowed to be used by the wider community except for the permanent ones created by mods and admins. Therefore, this issue is still stalled yes.