Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit e8b5e68

Browse files
authored
Merge pull request #67 from is-a-dev/developments
Remove dangerous command
2 parents 3545295 + 5bea42f commit e8b5e68

File tree

1 file changed

+70
-71
lines changed

1 file changed

+70
-71
lines changed

_orangcbot/extensions/fun.py

Lines changed: 70 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from psl_dns import PSL
99

1010
dotenv.load_dotenv()
11-
import asyncio
12-
import datetime
1311

1412
# import os
1513

@@ -63,47 +61,48 @@ async def _confirm(
6361
)
6462

6563

66-
class SlapView(nextcord.ui.View):
67-
if TYPE_CHECKING:
68-
_message: Optional[nextcord.Message]
69-
70-
def __init__(self, *, invitation: _BattleInvitation, ctx: commands.Context):
71-
super().__init__()
72-
self._invitation = invitation
73-
self._ctx: commands.Context = ctx
74-
self._message: Optional[nextcord.Message] = None
75-
self._user_1_count: int = 0
76-
self._user_2_count: int = 0
77-
78-
async def timeout(self):
79-
await asyncio.sleep(90)
80-
self.children[0].disabled = True # type: ignore[reportAttributeAccessIssue]
81-
self.stop()
82-
83-
def set_message(self, message: nextcord.Message):
84-
self.message = message
85-
86-
def determine_winner(self):
87-
return (
88-
self._invitation.uid1
89-
if self._user_1_count > self._user_2_count
90-
else self._invitation.uid2
91-
)
92-
93-
@nextcord.ui.button(label="Slap!", style=nextcord.ButtonStyle.red)
94-
async def _slap(
95-
self, button: nextcord.ui.Button, interaction: nextcord.Interaction
96-
):
97-
if interaction.user.id == self._invitation.uid1: # type: ignore[reportOptionalMemberAccess]
98-
self._user_1_count += 1
99-
await interaction.response.defer()
100-
if interaction.user.id == self._invitation.uid2: # type: ignore[reportOptionalMemberAccess]
101-
self._user_2_count += 1
102-
await interaction.response.defer()
103-
else:
104-
await interaction.response.send_message(
105-
"You are not a competitor.", ephemeral=True
106-
)
64+
# class SlapView(nextcord.ui.View):
65+
# if TYPE_CHECKING:
66+
# _message: Optional[nextcord.Message]
67+
#
68+
# def __init__(self, *, invitation: _BattleInvitation, ctx: commands.Context):
69+
# super().__init__()
70+
# self._invitation = invitation
71+
# self._ctx: commands.Context = ctx
72+
# self._message: Optional[nextcord.Message] = None
73+
# self._user_1_count: int = 0
74+
# self._user_2_count: int = 0
75+
#
76+
# async def timeout(self):
77+
# await asyncio.sleep(90)
78+
# self.children[0].disabled = True # type: ignore[reportAttributeAccessIssue]
79+
# self.stop()
80+
#
81+
# def set_message(self, message: nextcord.Message):
82+
# self.message = message
83+
#
84+
# def determine_winner(self):
85+
# return (
86+
# self._invitation.uid1
87+
# if self._user_1_count > self._user_2_count
88+
# else self._invitation.uid2
89+
# )
90+
#
91+
# @nextcord.ui.button(label="Slap!", style=nextcord.ButtonStyle.red)
92+
# async def _slap(
93+
# self, button: nextcord.ui.Button, interaction: nextcord.Interaction
94+
# ):
95+
# if interaction.user.id == self._invitation.uid1: # type: ignore[reportOptionalMemberAccess]
96+
# self._user_1_count += 1
97+
# await interaction.response.defer()
98+
# if interaction.user.id == self._invitation.uid2: # type: ignore[reportOptionalMemberAccess]
99+
# self._user_2_count += 1
100+
# await interaction.response.defer()
101+
# else:
102+
# await interaction.response.send_message(
103+
# "You are not a competitor.", ephemeral=True
104+
# )
105+
#
107106

108107

109108
class BonkView(nextcord.ui.View):
@@ -201,34 +200,34 @@ async def ubdict(self, ctx: commands.Context, *, word: str):
201200
)
202201
await ctx.send(embed=embed)
203202

204-
@commands.command()
205-
@commands.is_owner()
206-
async def slappy(self, ctx: commands.Context, *, user: nextcord.Member):
207-
inv = _BattleInvitation(ctx.author.id, user.id)
208-
await ctx.send(
209-
f"<@{int(user.id)}>, <@{int(ctx.author.id)}> has invited you to a Slappy Slappy game.",
210-
allowed_mentions=nextcord.AllowedMentions.none(),
211-
view=SlapConfirmView(ctx, inv),
212-
)
213-
214-
def check(m: _BattleInvitation):
215-
return m.id == inv.id
216-
217-
await ctx.bot.wait_for("battle_acceptance", check=check, timeout=60)
218-
k = SlapView(invitation=inv, ctx=ctx)
219-
end = datetime.datetime.now() + datetime.timedelta(seconds=90)
220-
i = await ctx.send(
221-
f"<@{int(inv.uid1)}> and <@{inv.uid2}> has gone for a Slappy Slappy game. Press the button to score. This game ends in {nextcord.utils.format_dt(end, style='R')}.",
222-
allowed_mentions=nextcord.AllowedMentions.none(),
223-
view=k,
224-
)
225-
await k.wait()
226-
winner = k.determine_winner()
227-
await i.edit(
228-
content=f"<@{inv.uid1}> and <@{inv.uid2}> played a Slappy Slappy game in which <@{winner}> was the winner. This game has ended in {nextcord.utils.format_dt(end)}.",
229-
allowed_mentions=nextcord.AllowedMentions.none(),
230-
view=k,
231-
)
203+
# @commands.command()
204+
# @commands.is_owner()
205+
# async def slappy(self, ctx: commands.Context, *, user: nextcord.Member):
206+
# inv = _BattleInvitation(ctx.author.id, user.id)
207+
# await ctx.send(
208+
# f"<@{int(user.id)}>, <@{int(ctx.author.id)}> has invited you to a Slappy Slappy game.",
209+
# allowed_mentions=nextcord.AllowedMentions.none(),
210+
# view=SlapConfirmView(ctx, inv),
211+
# )
212+
#
213+
# def check(m: _BattleInvitation):
214+
# return m.id == inv.id
215+
#
216+
# await ctx.bot.wait_for("battle_acceptance", check=check, timeout=60)
217+
# k = SlapView(invitation=inv, ctx=ctx)
218+
# end = datetime.datetime.now() + datetime.timedelta(seconds=90)
219+
# i = await ctx.send(
220+
# f"<@{int(inv.uid1)}> and <@{inv.uid2}> has gone for a Slappy Slappy game. Press the button to score. This game ends in {nextcord.utils.format_dt(end, style='R')}.",
221+
# allowed_mentions=nextcord.AllowedMentions.none(),
222+
# view=k,
223+
# )
224+
# await k.wait()
225+
# winner = k.determine_winner()
226+
# await i.edit(
227+
# content=f"<@{inv.uid1}> and <@{inv.uid2}> played a Slappy Slappy game in which <@{winner}> was the winner. This game has ended in {nextcord.utils.format_dt(end)}.",
228+
# allowed_mentions=nextcord.AllowedMentions.none(),
229+
# view=k,
230+
# )
232231

233232
@commands.command()
234233
async def moral(

0 commit comments

Comments
 (0)