-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (43 loc) · 1.56 KB
/
main.py
File metadata and controls
49 lines (43 loc) · 1.56 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# -*- coding: utf-8 -*-
import asyncio
import discord
import os
entry_id = 736628061289578496
server_id = 736622331178254426
hello_id = 737068025253200069
server_id = int(server_id)
entry_id = int(entry_id)
hello_id = int(hello_id)
client = discord.Client()
async def send(channel,*args, **kwargs): return await channel.send(*args, **kwargs)
@client.event
async def on_member_join(member):
lrn = []
for role in member.roles:
lrn.append(role.name)
if len(lrn) == 2:
break
m = "Hi!<@"+str(member.id)+">,\nPlease read <#736628061289578496> and type [ok]. \nIf you are going to to be able to do it, please introduse yourself in <#736627134604378143>.\n"
channel = client.get_channel(737576896476348447)
await channel.send(m)
@client.event
async def on_ready():
print("Bot is ready")
@client.event
async def on_message(message):
if message.author.bot:
return
if message.guild.id == server_id:
if message.content == "ok":
lrn = []
for role in message.author.roles:
lrn.append(role.name)
if len(lrn) == 2:
return
role = discord.utils.get(message.guild.roles, name="自己紹介してね")
return await message.author.add_roles(role)
message_to = "<@"+str(member.id)+">,\nPlease introduse yourself in <#736627134604378143>.\n"
channel = client.get_channel(737576896476348447)
return await channel.send(message_to)
if __name__ == "__main__":
client.run(os.environ['MARK1_TOKEN'])