3
3
Description:
4
4
This is a template to create your own discord bot in python.
5
5
6
- Version: 5.1
6
+ Version: 5.2
7
7
"""
8
8
9
9
import random
13
13
from discord import app_commands
14
14
from discord .ext import commands
15
15
from discord .ext .commands import Context
16
-
17
16
from helpers import checks
18
17
19
18
@@ -66,7 +65,10 @@ async def callback(self, interaction: discord.Interaction):
66
65
bot_choice_index = choices [bot_choice ]
67
66
68
67
result_embed = discord .Embed (color = 0x9C84EF )
69
- result_embed .set_author (name = interaction .user .name , icon_url = interaction .user .avatar .url )
68
+ result_embed .set_author (
69
+ name = interaction .user .name ,
70
+ icon_url = interaction .user .avatar .url
71
+ )
70
72
71
73
if user_choice_index == bot_choice_index :
72
74
result_embed .description = f"**That's a draw!**\n You've chosen { user_choice } and I've chosen { bot_choice } ."
@@ -104,7 +106,7 @@ def __init__(self, bot):
104
106
async def randomfact (self , context : Context ) -> None :
105
107
"""
106
108
Get a random fact.
107
-
109
+
108
110
:param context: The hybrid command context.
109
111
"""
110
112
# This will prevent your bot from stopping everything when doing a web request - see: https://discordpy.readthedocs.io/en/stable/faq.html#how-do-i-make-a-web-request
@@ -132,7 +134,7 @@ async def randomfact(self, context: Context) -> None:
132
134
async def coinflip (self , context : Context ) -> None :
133
135
"""
134
136
Make a coin flip, but give your bet before.
135
-
137
+
136
138
:param context: The hybrid command context.
137
139
"""
138
140
buttons = Choice ()
@@ -143,7 +145,6 @@ async def coinflip(self, context: Context) -> None:
143
145
message = await context .send (embed = embed , view = buttons )
144
146
await buttons .wait () # We wait for the user to click a button.
145
147
result = random .choice (["heads" , "tails" ])
146
- print (buttons .value )
147
148
if buttons .value == result :
148
149
embed = discord .Embed (
149
150
description = f"Correct! You guessed `{ buttons .value } ` and I flipped the coin to `{ result } `." ,
@@ -164,7 +165,7 @@ async def coinflip(self, context: Context) -> None:
164
165
async def rock_paper_scissors (self , context : Context ) -> None :
165
166
"""
166
167
Play the rock paper scissors game against the bot.
167
-
168
+
168
169
:param context: The hybrid command context.
169
170
"""
170
171
view = RockPaperScissorsView ()
0 commit comments