mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-04 17:06:21 +00:00
Add message content intent to examples
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
from discord.ext import commands
|
||||
|
||||
import discord
|
||||
@ -5,7 +7,10 @@ import discord
|
||||
|
||||
class Bot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
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})')
|
||||
|
@ -1,3 +1,5 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
from discord.ext import commands
|
||||
|
||||
import discord
|
||||
@ -5,7 +7,10 @@ import discord
|
||||
|
||||
class CounterBot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
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})')
|
||||
|
@ -1,3 +1,5 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
import typing
|
||||
|
||||
import discord
|
||||
@ -39,7 +41,10 @@ class DropdownView(discord.ui.View):
|
||||
|
||||
class Bot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
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})')
|
||||
|
@ -1,10 +1,15 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
from discord.ext import commands
|
||||
|
||||
import discord
|
||||
|
||||
class EphemeralCounterBot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
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})')
|
||||
|
@ -1,3 +1,5 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
from discord.ext import commands
|
||||
|
||||
import discord
|
||||
@ -5,7 +7,10 @@ from urllib.parse import quote_plus
|
||||
|
||||
class GoogleBot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
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})')
|
||||
|
@ -1,3 +1,5 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
|
||||
@ -29,7 +31,10 @@ class PersistentView(discord.ui.View):
|
||||
|
||||
class PersistentViewBot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'), intents=intents)
|
||||
self.persistent_views_added = False
|
||||
|
||||
async def on_ready(self):
|
||||
|
@ -1,3 +1,5 @@
|
||||
# This example requires the 'message_content' privileged intent to function.
|
||||
|
||||
from typing import List
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
@ -120,7 +122,10 @@ class TicTacToe(discord.ui.View):
|
||||
|
||||
class TicTacToeBot(commands.Bot):
|
||||
def __init__(self):
|
||||
super().__init__(command_prefix=commands.when_mentioned_or('$'))
|
||||
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})')
|
||||
|
Reference in New Issue
Block a user