-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathVerificationBot.py
More file actions
102 lines (69 loc) · 3.3 KB
/
Copy pathVerificationBot.py
File metadata and controls
102 lines (69 loc) · 3.3 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
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
import discord
from subprocess import check_output
import io
import time
import asyncio
import json
import os
import requests
from datetime import date
def IDVerification(id):
with open('userID.txt', 'w') as f:
f.write(id)
p = check_output(['node', 'discordVerification.js'])
p = str(p)
isStudent = False
if ("false" in p):
isStudent = False
else:
isStudent = True
return isStudent
intents = discord.Intents.default()
intents.message_content = True
intents.voice_states = True
intents.members = True
client = discord.Client(intents=intents)
global messageChannel
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.online, activity=discord.Game('Verifying Students'))
@client.event
async def on_message(message):
if ("ticket" in message.channel.name) and (message.author.id != 1099412234154803211) and (message.author.id != 508391840525975553):
studID = message.content
isStudent = IDVerification(studID)
userID = message.author.id
logchannel = client.get_channel(882624153545506837)
role = discord.utils.get(message.guild.roles,name="Members")
target_member = message.guild.get_member(int(userID))
if (isStudent == True):
await target_member.add_roles(role)
await message.channel.send("You have been verified! This channel will be closed in a few seconds.")
await logchannel.send(f"{studID}, verified")
time.sleep(10)
await message.channel.delete()
else:
await message.channel.send("Invalid student ID! Try sending it again. It should look like: 'nss5405'. If you keep getting this error, wait and a staff member will be able to assist you within a few hours.")
return
#message.guild.get_member(255002520236064768)
#print(message.channel.id)
#if (message.channel.id != 729321259065802783) and (message.channel.id != 883157408136962088):
#if message.author.id == 508391840525975553:
#embed = message.embeds[0]
#if embed.description == "Please enter your PSU User ID in order to be verified.":
#messageChannel = message.channel.id
#studID = embed.description
#isStudent = IDVerification(studID)
#userID = embed.footer.text.split(" | ")
#theirID = userID[1].strip()
#role = discord.utils.get(message.guild.roles,name="Members")
#target_member = message.guild.get_member(int(theirID))
#if (isStudent == True):
#await target_member.add_roles(role)
#await message.channel.send("You have been verified! This channel will be closed in a few seconds.")
#time.sleep(10)
#await message.channel.send(f"=aclose {studID}, verified")
#else:
#await message.channel.send("Invalid student ID! Try sending it again. It should look like: 'nss5405'. If you keep getting this error, wait and a staff member will be able to assist you within a few hours.")
#return
client.run(#INPUT DISCORD BOT TOKEN HERE#)