-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.py
More file actions
27 lines (20 loc) · 743 Bytes
/
welcome.py
File metadata and controls
27 lines (20 loc) · 743 Bytes
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
#!/bin/python3 -u
import discord
import os
from dotenv import load_dotenv
from discord.ext import commands
from datetime import datetime
load_dotenv()
intents = discord.Intents.all()
client = commands.Bot(command_prefix='!', intents=intents)
@client.event
async def on_ready():
print('welcome started on bot {0.user}'.format(client))
@client.event
async def on_member_join(member):
welcome_chan = client.get_channel(int(os.getenv('welcome_chan')))
welcome_file = open("welcome.msg", "r")
await welcome_chan.send("Hey <@!" + str(member.id) + ">, welcome to **" + member.guild.name + "**!\n\n" + str(welcome_file.read()))
print(member.name, "joined the server")
welcome_file.close()
client.run(os.getenv('TOKEN'))