Spaces:
Sleeping
Sleeping
Rifat Azad commited on
Commit ยท
1d2668d
1
Parent(s): cce1709
fixed coinflip
Browse files- pydvpl_bot.py +4 -6
pydvpl_bot.py
CHANGED
|
@@ -296,7 +296,7 @@ async def help(ctx):
|
|
| 296 |
# Add fields for different categories of commands with their descriptions
|
| 297 |
embed.add_field(name="PyDVPL Prefix:", value="`/` - Discord's slash command prefix.\n`>>` - PyDVPL default prefix.")
|
| 298 |
embed.add_field(name="Dvpl Commands:", value="`compress` - Compresses files.\n`decompress` - Decompresses files.", inline=False)
|
| 299 |
-
embed.add_field(name="User Utility Commands:", value="`ping` - Checks the bot's latency.\n`invite` - Get the bot's invite link.\n`uptime` - Displays the bot's uptime.\n`clock` - Shows the current date and time.\n`chat` - Chat with AI LLM models like 'phind', 'chatgpt' & 'blackboxai'.\n`coinflip - Plays a coinflip game with
|
| 300 |
embed.add_field(name="Premium User Commands:", value="`chat` - Chat with AI LLM models like 'phind', 'chatgpt' & 'blackboxai'.\n`image` - Generate images with 'craiyon' AI.", inline=False)
|
| 301 |
embed.add_field(name="Moderator Commands:", value="`kick` - Kick a member from the server.\n`ban` - Ban a member from the server.\n`timeout` - Timeout a member for a specified duration.\n`purge` - Bulk deletes set amount of messages in guilds.", inline=False)
|
| 302 |
embed.add_field(name="Admin Utility Commands:", value="`stats` - Displays bot statistics.\n`list` - Lists server members.\n`say` - Make the bot say something.\n`announce` - Announces a message to a channel.\n`activity` - Sets bot activity status.\n`online` - Sets bot status to online.\n`dnd` - Sets bot status to Do Not Disturb.\n`offline` - Sets bot status to offline.\n`clean` - Cleans up bot's messages.\n`update` - Update a Python package using pip.\n`ip` - Shows the IP address of the current server.", inline=False)
|
|
@@ -839,7 +839,7 @@ async def image(ctx, *, prompt: str):
|
|
| 839 |
# FUNCTION ------------------------------------------------------ SPLIT
|
| 840 |
|
| 841 |
|
| 842 |
-
@bot.command(help="Plays a coinflip game with
|
| 843 |
async def coinflip(ctx):
|
| 844 |
emojis = ["๐", "๐ธ"] # Add more emojis if needed
|
| 845 |
|
|
@@ -858,15 +858,12 @@ async def coinflip(ctx):
|
|
| 858 |
return user == ctx.author and str(reaction.emoji) in emojis
|
| 859 |
|
| 860 |
try:
|
| 861 |
-
reaction,
|
| 862 |
user_choice = reaction.emoji
|
| 863 |
except asyncio.TimeoutError:
|
| 864 |
await ctx.send("You didn't react in time. Aborting...")
|
| 865 |
return
|
| 866 |
|
| 867 |
-
if user == bot.user: # If the bot reacted, skip waiting
|
| 868 |
-
user_choice = random.choice(emojis)
|
| 869 |
-
|
| 870 |
await asyncio.sleep(1)
|
| 871 |
|
| 872 |
for i in range(3, 0, -1):
|
|
@@ -874,6 +871,7 @@ async def coinflip(ctx):
|
|
| 874 |
await flip_msg.edit(embed=embed)
|
| 875 |
await asyncio.sleep(1)
|
| 876 |
|
|
|
|
| 877 |
result = random.choice(emojis)
|
| 878 |
embed.description = f"The result is **{result}**!"
|
| 879 |
|
|
|
|
| 296 |
# Add fields for different categories of commands with their descriptions
|
| 297 |
embed.add_field(name="PyDVPL Prefix:", value="`/` - Discord's slash command prefix.\n`>>` - PyDVPL default prefix.")
|
| 298 |
embed.add_field(name="Dvpl Commands:", value="`compress` - Compresses files.\n`decompress` - Decompresses files.", inline=False)
|
| 299 |
+
embed.add_field(name="User Utility Commands:", value="`ping` - Checks the bot's latency.\n`invite` - Get the bot's invite link.\n`uptime` - Displays the bot's uptime.\n`clock` - Shows the current date and time.\n`chat` - Chat with AI LLM models like 'phind', 'chatgpt' & 'blackboxai'.\n`coinflip - Plays a coinflip game with the bot`", inline=False)
|
| 300 |
embed.add_field(name="Premium User Commands:", value="`chat` - Chat with AI LLM models like 'phind', 'chatgpt' & 'blackboxai'.\n`image` - Generate images with 'craiyon' AI.", inline=False)
|
| 301 |
embed.add_field(name="Moderator Commands:", value="`kick` - Kick a member from the server.\n`ban` - Ban a member from the server.\n`timeout` - Timeout a member for a specified duration.\n`purge` - Bulk deletes set amount of messages in guilds.", inline=False)
|
| 302 |
embed.add_field(name="Admin Utility Commands:", value="`stats` - Displays bot statistics.\n`list` - Lists server members.\n`say` - Make the bot say something.\n`announce` - Announces a message to a channel.\n`activity` - Sets bot activity status.\n`online` - Sets bot status to online.\n`dnd` - Sets bot status to Do Not Disturb.\n`offline` - Sets bot status to offline.\n`clean` - Cleans up bot's messages.\n`update` - Update a Python package using pip.\n`ip` - Shows the IP address of the current server.", inline=False)
|
|
|
|
| 839 |
# FUNCTION ------------------------------------------------------ SPLIT
|
| 840 |
|
| 841 |
|
| 842 |
+
@bot.command(help="Plays a coinflip game with the bot")
|
| 843 |
async def coinflip(ctx):
|
| 844 |
emojis = ["๐", "๐ธ"] # Add more emojis if needed
|
| 845 |
|
|
|
|
| 858 |
return user == ctx.author and str(reaction.emoji) in emojis
|
| 859 |
|
| 860 |
try:
|
| 861 |
+
reaction, _ = await bot.wait_for('reaction_add', timeout=30.0, check=check)
|
| 862 |
user_choice = reaction.emoji
|
| 863 |
except asyncio.TimeoutError:
|
| 864 |
await ctx.send("You didn't react in time. Aborting...")
|
| 865 |
return
|
| 866 |
|
|
|
|
|
|
|
|
|
|
| 867 |
await asyncio.sleep(1)
|
| 868 |
|
| 869 |
for i in range(3, 0, -1):
|
|
|
|
| 871 |
await flip_msg.edit(embed=embed)
|
| 872 |
await asyncio.sleep(1)
|
| 873 |
|
| 874 |
+
# Randomly choose the result
|
| 875 |
result = random.choice(emojis)
|
| 876 |
embed.description = f"The result is **{result}**!"
|
| 877 |
|