mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Run black on all examples and require it for CI
This commit is contained in:
@ -15,7 +15,7 @@ class Dropdown(discord.ui.Select):
|
||||
options = [
|
||||
discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
|
||||
discord.SelectOption(label='Green', description='Your favourite colour is green', emoji='🟩'),
|
||||
discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦')
|
||||
discord.SelectOption(label='Blue', description='Your favourite colour is blue', emoji='🟦'),
|
||||
]
|
||||
|
||||
# The placeholder is what will be shown when no option is chosen
|
||||
@ -26,7 +26,7 @@ class Dropdown(discord.ui.Select):
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
# Use the interaction object to send a response message containing
|
||||
# the user's favourite colour or choice. The self object refers to the
|
||||
# Select object, and the values attribute gets a list of the user's
|
||||
# Select object, and the values attribute gets a list of the user's
|
||||
# selected options. We only want the first one.
|
||||
await interaction.response.send_message(f'Your favourite colour is {self.values[0]}')
|
||||
|
||||
@ -43,14 +43,14 @@ class Bot(commands.Bot):
|
||||
def __init__(self):
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
|
||||
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'), intents=intents)
|
||||
|
||||
async def on_ready(self):
|
||||
print(f'Logged in as {self.user} (ID: {self.user.id})')
|
||||
print('------')
|
||||
|
||||
|
||||
|
||||
|
||||
bot = Bot()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user