NEW
Font size
WorksheetsDiscord.py Quiz
Total questions: 20
Worksheet time: 10mins
Which command is used to install the discord.py library via pip?
pip install discord
pip install discord.py
npm install discord.js
pip get discord
What is the decorator used to register an event in a basic Client?
@client.command
@bot.event
@client.event
@event.register
Which object represents the context in which a command is invoked?
msg
ctx
context
cxt
What must be enabled in the Discord Developer Portal to track member joins/leaves?
Server Intents
Privileged Gateway Intents
Bot Token
Oauth2
Which keyword is used to send a message back to the channel in a command?
ctx.write()
return message
await ctx.send()
ctx.reply_message()
What acts as the prefix in this code: commands.Bot(command_prefix='!')?
The dot (.)
The exclamation mark (!)
The word Bot
No prefix is set
Which function is commonly used to print a message when the bot has successfully logged in?
on_login
on_connect
on_ready
on_start
In discord.py, most API interacting functions must be awaited because the library is...
Synchronous
Asynchronous
Multi-threaded
Blocking
What argument do you pass to 'client.run()' to start the bot?
Client ID
Client Secret
Bot Token
Public Key
Which class allows you to create rich content messages with titles, descriptions, and colors?
discord.RichText
discord.Embed
discord.Card
discord.Message
What is the primary purpose of 'Cogs' in discord.py?
To increase bot speed
To organize commands into classes/files
To encrypt the token
To play music
How do you load an extension named 'music' located in the 'cogs' folder?
bot.load('cogs.music')
await bot.load_extension('cogs.music')
import cogs.music
bot.add_cog('music')
Which decorator is used to check if a user has specific permissions before running a command?
@commands.check_perms
@commands.has_permissions
@bot.verify
@discord.permit
What exception is raised when a user tries to run a command they don't have permission for?
PermissionError
AccessDenied
MissingPermissions
ForbiddenCommand
In a Cog, what must be passed as the first argument to every command method?
ctx
self
bot
message
How do you convert a user input string like '' directly into a Member object in a command argument?
Use regex
Type hint the argument with discord.Member
Manually fetch the ID
It happens automatically for all strings
What is the correct way to change the bot's status (presence)?
bot.set_status()
await bot.change_presence()
client.update_status()
bot.status = 'online'
What does 'bot.latency' return?
The bot uptime
The ping (latency) in seconds
The number of servers
The token age
What is 'Sharding' used for in discord.py?
Splitting the bot across multiple processes for high guild counts
Deleting messages in bulk
Sharing the token
Creating slash commands
Which library is built-in to discord.py for handling scheduled background tasks?
discord.timer
discord.ext.tasks
asyncio.schedule
threading
