This repository was archived by the owner on Dec 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWelcome.py
47 lines (42 loc) · 2.33 KB
/
Welcome.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
import discord
import random
from discord import client
from discord.ext.commands.cog import Cog
import Util
from datetime import datetime
from discord.ext import commands
class Welcome(commands.Cog):
def __init__(self, client):
self.client = client
async def welcomeEmbedReturner(self, target : discord.Member):
welcomeEmbed = discord.Embed(title = "Welcome to the BlueLearn Discord Server!",
description = "Make sure that you have a **verified email connected to your account** so that you can interact in the server. \nHere are a few things that you can do:",
colour = random.randint(0, 0xffffff),
url = 'https://www.bluelearn.in/')
welcomeEmbed.add_field(name="Read the Rules",
value="Read the rules from the <#752804052278050817> channel carefully.",
inline=False)
welcomeEmbed.add_field(name="Check out the Server Tutorial Video",
value="If you are new to discord, you can watch a tutorial video which will help you to go about the server.\n**Tutorial:** [Click here](https://youtu.be/AUimFYOBXYU?t=291)",
inline=False)
welcomeEmbed.add_field(name="Getting to know you",
value="Please fill up this form so that we know your interests and can make the community better! **[Click here](https://forms.gle/5Zhums746RWRcAhu7)**")
welcomeEmbed.set_image(url='https://res.cloudinary.com/zeusabhijeet/image/upload/v1624014516/Clinify%20Stuff/Bluelearn_welcome_banner_1.gif')
welcomeEmbed.set_author(name=target.name, icon_url=target.avatar_url)
return welcomeEmbed
@commands.command(name='welcomedm')
@commands.has_permissions(administrator = True)
async def welcomedm(self, ctx, targetMember : discord.Member = None):
if targetMember == None:
targetMember = ctx.message.author
await targetMember.send(embed = await self.welcomeEmbedReturner(targetMember))
await ctx.send(f'Successfully sent DM to {targetMember}')
@Cog.listener()
async def on_member_join(self, member):
await member.send(embed = await self.welcomeEmbedReturner(member))
JoinLogEmbed = discord.Embed(title = "SleepBot Welcome DM Log",
description = "Sent DM Message Successfully to: Username: {} ID: {} at {}".format(member, member.id, datetime.now()),
colour = random.randint(0, 0xffffff))
await self.client.get_channel(Util.LOG[0]).send(embed = JoinLogEmbed)
def setup(client):
client.add_cog(Welcome(client))