Because it does not work ?
import discord
import asyncio
import random
client = discord.Client()
@client.event
async def on_ready():
print('BOT')
print(client.user.name)
print(client.user.id)
print('---------------')
@client.event
async def on_member_join(member):
serverchannel = member.server.default_channel
msg = "Willkommen {0} auf {1}".format(member.mention, member.server.name)
await client.send_message(serverchannel, msg)
@client.event
async def on_member_remove(member):
serverchannel = member.server.default_channel
msg = "Bye Bye {0}".format(member.mention)
await client.send_message(serverchannel, msg)
client.run('token')
Default channels are defunct as of some time ago, they no longer work due to discord removing them. Obtain a destination through some other means, usually by having a user set it and retrieving it with client.get_channel
how can I send to the user's DM then?
.send_message(member,content)
I can also use,
channel = discord.Object("id-channel")
to set the channel that will display msg?
Sure, but it's better to just use client.get_channel.
one last question on the subject, how do I mention a server channel in the user's DM?
Most helpful comment
.send_message(member,content)