-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
34 lines (27 loc) · 1.05 KB
/
main.py
File metadata and controls
34 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import discord, os, traceback
intents = discord.Intents(guilds = True, dm_messages = True, members = True, messages = True, guild_messages = True, invites = True)
client = discord.Client(chunk_guilds_at_startup = True, intents = intents)
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
game = discord.Game("Welcoming people to the MeowCafe!")
await client.change_presence(activity = game)
return
@client.event
async def on_member_join(member) :
try :
if member.dm_channel == None :
await member.create_dm()
await member.dm_channel.send('hello welcome to MeowCafe!')
await member.guild.system_channel.send('hello ' + member.name + ' welcome to MeowCafe!')
except Exception as err :
print('Some error occured in the on_member_join function', Exception, err)
traceback.print_exc()
return
@client.event
async def on_member_remove(member) :
return
@client.event
async def on_message(message):
return
client.run(os.environ['BOT_TOKEN'])