Update welcome-bot.py

This commit is contained in:
Mikey
2020-11-19 12:50:38 -05:00
committed by GitHub
parent b4edc53cee
commit 0ddc59c707
+6 -6
View File
@@ -6,7 +6,7 @@ import discord
import asyncio import asyncio
intents = discord.Intents(members=True) intents = discord.Intents(members=True)
client=discord.Client(intents=intents) client=discord.Client(intents=intents)
welcomechannel = await client.fetch_channel(channel_id) #https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID welcomechannel = await client.fetch_channel(channel_id) # https://support.discord.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID
# Make sure you get the ID of your channel by right-clicking it and clicking `Copy ID`. Make sure developer mode is on! # Make sure you get the ID of your channel by right-clicking it and clicking `Copy ID`. Make sure developer mode is on!
@client.event @client.event
async def on_ready(): async def on_ready():
@@ -14,8 +14,8 @@ async def on_ready():
print(client.user.name) print(client.user.name)
print(client.user.id) print(client.user.id)
print('-----') print('-----')
# Customise the message below to what you want to send new users!
newUserMessage = """ # customise this to the message you want to send new users newUserMessage = """
You You
can can
put put
@@ -39,7 +39,7 @@ async def on_member_join(member):
color=discord.Color.green() color=discord.Color.green()
) )
role = discord.utils.get(member.server.roles, name="name-of-your-role") # Gets the member role as a `role` object role = discord.utils.get(member.server.roles, name="name-of-your-role") # Gets the member role as a `role` object
await client.add_roles(member, role) # Gives the role to the user await client.add_roles(member, role) # Gives the role to the user
print("Added role '" + role.name + "' to " + member.name) print("Added role '" + role.name + "' to " + member.name)
@@ -48,7 +48,7 @@ async def on_member_leave(member):
print("Recognised that a member called " + member.name + " left") print("Recognised that a member called " + member.name + " left")
embed=discord.Embed( embed=discord.Embed(
title="😢 Goodbye "+member.name+"!", title="😢 Goodbye "+member.name+"!",
description="Until we meet again old friend." #A description isn't necessary, you can delete this line if you don't want a description. description="Until we meet again old friend." # A description isn't necessary, you can delete this line if you don't want a description.
color=discord.Color.red() #There are lots of colors, you can check them here: https://discordpy.readthedocs.io/en/latest/api.html?highlight=discord%20color#discord.Colour color=discord.Color.red() # There are lots of colors, you can check them here: https://discordpy.readthedocs.io/en/latest/api.html?highlight=discord%20color#discord.Colour
) )
client.run('token') client.run('token')