.github
discord
docs
examples
background_task.py
background_task_asyncio.py
basic_bot.py
basic_voice.py
converters.py
custom_context.py
deleted.py
edits.py
guessing_game.py
new_member.py
reaction_roles.py
reply.py
secret.py
.gitignore
.readthedocs.yml
LICENSE
MANIFEST.in
README.ja.rst
README.rst
requirements.txt
setup.py
22 lines
580 B
Python
22 lines
580 B
Python
# This example requires the 'members' privileged intents
|
|
|
|
import discord
|
|
|
|
class MyClient(discord.Client):
|
|
async def on_ready(self):
|
|
print(f'Logged in as {self.user} (ID: {self.user.id})')
|
|
print('------')
|
|
|
|
async def on_member_join(self, member):
|
|
guild = member.guild
|
|
if guild.system_channel is not None:
|
|
to_send = f'Welcome {member.mention} to {guild.name}!'
|
|
await guild.system_channel.send(to_send)
|
|
|
|
|
|
intents = discord.Intents.default()
|
|
intents.members = True
|
|
|
|
client = MyClient(intents=intents)
|
|
client.run('token')
|