-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
109 lines (93 loc) · 3.96 KB
/
main.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
from dotenv import load_dotenv
import discord
import os
import random
import time
load_dotenv()
token = os.getenv('TOKEN')
client = discord.Client()
async def schedule_for_progress():
channelID = int(os.getenv('SCHEDULE_CHANNEL'))
channel = client.get_channel(channelID)
daily = ["@everyone showoff what you've learned or learning #100-days-of-code", "@everyone it's a new day #100-days-of-code!!", "@everyone #100-days-of-code", "@everyone 👉 #100-days-of-code", "100-days-of-code @everyone 🤗", "100-days-of-code @everyone 🤬"]
await channel.send(random.choice(daily))
@client.event
async def on_ready():
print('Rain is ready for battle!!')
activity = discord.Activity(name="something!! IDK, i'm anime girl", type=discord.ActivityType.listening)
await client.change_presence(activity=activity)
# welcomes new users s
@client.event
async def on_member_join(member):
for channel in member.guild.channels:
if str(channel) == "the-lobby":
embed = discord.Embed(title=f"{member}", color=0x2a8ef8)
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(name="!hello", value=f"""{member.mention} has joined the battle bus.""")
await channel.send(content=None, embed=embed)
# user lefts
@client.event
async def on_member_remove(member):
for channel in member.guild.channels:
if str(channel) == "the-lobby":
embed = discord.Embed(title=f"{member}", color=0xe31635)
embed.set_thumbnail(url=member.avatar_url)
embed.add_field(name="yo", value=f"""{member.mention} has lefts the battle bus.""")
await channel.send(content=None, embed=embed)
# profile updates
@client.event
async def on_user_update(before, after):
id = client.get_guild(int(os.getenv('SERVER_ID')))
for channel in id.channels:
if str(channel) == "🛸bot-spam":
embed = discord.Embed(title=f"{after}", description=f"{after.mention}Updated Profile!", color=0xeca427)
embed.set_thumbnail(url=after.avatar_url)
embed.add_field(name="before", value=before)
embed.add_field(name="after", value=after)
await channel.send(content=None, embed=embed)
# chat sec
@client.event
async def on_message(message):
id = client.get_guild(int(os.getenv('SERVER_ID')))
author = os.getenv('AUTHOR_ID')
admin = client.get_user(int(author))
hellos = ["hello", "Hello", "Hey", "hey", "Hi", "hi"]
if (message.guild is None):
for channel in id.channels:
if str(channel.name) == "soluctions" and "#soluction id:" in str(message.content):
await channel.send(f"{message.content}")
# ADMIN sec
if str(message.author.id) == str(author):
if message.content.split(', ')[0] == "sendMSG":
try:
authorID = int(message.content.split(', ')[1])
msg = message.content.split(', ')[2]
user = client.get_user(int(authorID))
await user.send(msg)
except:
print('(ADMIN)LOG: ', message.content)
await message.author.send("didn't geddt, Try again")
elif message.content.split(', ')[0] == "announce":
try:
channelID = int(message.content.split(', ')[1])
msg = message.content.split(', ')[2]
channel = client.get_channel(channelID)
await channel.send(msg)
except:
print('(ADMIN)LOG: ', message.content)
await message.author.send("didn't geddt, Try again")
elif str(message.content) == "codey":
await schedule_for_progress()
# USER sec
elif message.content.split(', ')[0] == "send":
try:
msg = message.content.split(', ')[1]
await admin.send('user : ', message.author,'msg: ', msg)
except:
print('(user)Log: ', message.content)
await message.author.send("didn't geddt, Try again")
elif str(message.channel):
if message.content.split(' ', 1)[0] in hellos:
# Todo: pass random messages
await message.channel.send(f"👋 {random.choice(hellos)} {message.author.mention}")
client.run(token)