mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-04 17:06:21 +00:00
Reformat entire project with ruff instead of black
This commit is contained in:
@ -22,7 +22,6 @@ class CounterBot(commands.Bot):
|
||||
|
||||
# Define a simple View that gives us a counter button
|
||||
class Counter(discord.ui.View):
|
||||
|
||||
# Define the actual button
|
||||
# When pressed, this increments the number displayed until it hits 5.
|
||||
# When it hits 5, the counter button is disabled and it turns green.
|
||||
|
@ -3,12 +3,12 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
|
||||
# Defines a custom Select containing colour options
|
||||
# that the user can choose. The callback function
|
||||
# of this class is called when the user changes their choice
|
||||
class Dropdown(discord.ui.Select):
|
||||
def __init__(self):
|
||||
|
||||
# Set the options that will be presented inside the dropdown
|
||||
options = [
|
||||
discord.SelectOption(label='Red', description='Your favourite colour is red', emoji='🟥'),
|
||||
|
@ -15,6 +15,7 @@ import re
|
||||
# `counter:5:user:80088516616269824` where the first number is the current count and the
|
||||
# second number is the user ID who owns the button.
|
||||
|
||||
|
||||
# Note that custom_ids can only be up to 100 characters long.
|
||||
class DynamicCounter(
|
||||
discord.ui.DynamicItem[discord.ui.Button],
|
||||
|
@ -22,7 +22,6 @@ class EphemeralCounterBot(commands.Bot):
|
||||
|
||||
# Define a simple View that gives us a counter button
|
||||
class Counter(discord.ui.View):
|
||||
|
||||
# Define the actual button
|
||||
# When pressed, this increments the number displayed until it hits 5.
|
||||
# When it hits 5, the counter button is disabled and it turns green.
|
||||
|
@ -9,24 +9,24 @@ import enum
|
||||
|
||||
|
||||
class FruitType(enum.Enum):
|
||||
apple = "Apple"
|
||||
banana = "Banana"
|
||||
orange = "Orange"
|
||||
grape = "Grape"
|
||||
mango = "Mango"
|
||||
watermelon = "Watermelon"
|
||||
coconut = "Coconut"
|
||||
apple = 'Apple'
|
||||
banana = 'Banana'
|
||||
orange = 'Orange'
|
||||
grape = 'Grape'
|
||||
mango = 'Mango'
|
||||
watermelon = 'Watermelon'
|
||||
coconut = 'Coconut'
|
||||
|
||||
@property
|
||||
def emoji(self) -> str:
|
||||
emojis = {
|
||||
"Apple": "🍎",
|
||||
"Banana": "🍌",
|
||||
"Orange": "🍊",
|
||||
"Grape": "🍇",
|
||||
"Mango": "🥭",
|
||||
"Watermelon": "🍉",
|
||||
"Coconut": "🥥",
|
||||
'Apple': '🍎',
|
||||
'Banana': '🍌',
|
||||
'Orange': '🍊',
|
||||
'Grape': '🍇',
|
||||
'Mango': '🥭',
|
||||
'Watermelon': '🍉',
|
||||
'Coconut': '🥥',
|
||||
}
|
||||
return emojis[self.value]
|
||||
|
||||
|
@ -4,6 +4,7 @@ from typing import List
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
|
||||
|
||||
# Defines a custom button that contains the logic of the game.
|
||||
# The ['TicTacToe'] bit is for type hinting purposes to tell your IDE or linter
|
||||
# what the type of `self.view` is. It is not required.
|
||||
|
Reference in New Issue
Block a user