async def ModifyMeeting(message): time = findall("[Tt]ime\s*:\s*[0-9][0-2]*:[0-9]{2}\s*[A|a|P|p][m|M],*", message.content.lower())[0] day = findall("[Dd]ay\s*:\s*\w+day\s*,*", message.content.lower())[0] location = findall("[Ll]ocation\s*:.+,*", message.content.lower())[0] topic = findall("[Tt]opic\s*:.+,*", message.content.lower())[0] id = findall("[iI][Dd]\s*:.+,*", message.content.lower())[0] time = time[time.index(':') + 1:time.index(',') if ',' in time else len(time)].strip() day = day[day.index(':') + 1:day.index(',') if ',' in day else len(day)].strip() location = location[location.index(':') + 1:location.index(',') if ',' in location else len(location)].strip() topic = topic[topic.index(':') + 1:topic.index(',') if ',' in topic else len(topic)].strip() id = int(id[id.index(':') + 1:id.index(',') if ',' in id else len(id)].strip()) for x in meetings[message.author.name]: if x.active == True and x.meeting_id == id: x.time = word_to_date(time, day) x.topic = topic x.location = location channel = client.get_channel(807682739523682330) await channel.send( "Hello every one Bo2loz here\n" + message.author.name + " Just modified the " + topic + " meeting!!!\n" + "meeting location : " + location + "\nmeeting time : " + day + " " + time + "\nmeeting topic :" + topic + "\n\nif you have any excuses please send me a message containing the word (excuse) and your excuse\n\nalways glad to help :nerd: :nerd: :nerd:" ) await message.channel.send("meeting modified successfully !") SaveConfig() return await message.channel.send("error modifying meeting !") return
async def CancelMeeting(message): id = findall("[iI][Dd]\s*:.+,*", message.content.lower())[0] id = int(id[id.index(':') + 1:len(id)].strip()) for x in meetings[message.author.name]: if x.active == True and x.meeting_id == int(id): meetings[message.author.name].remove(x) channel = client.get_channel(id) await channel.delete() channel = client.get_channel(807682739523682330) await channel.send( "Hello every one Bo2loz here\n" + message.author.name + " Just Cancelled the " + x.topic + " meeting\n\nalways glad to help :nerd: :nerd: :nerd:") await message.channel.send("meeting Cancelled successfully !") SaveConfig() return await message.channel.send( "Error cancelling the meeting\n please check your meeting id") return
async def send_memes(): Channel = client.get_channel(807937662899847188) all_subs = [] subreddit = reddit.subreddit("ProgrammerHumor") top = subreddit.hot(limit=50) for submission in top: all_subs.append(submission) random_sub = random.choice(all_subs) name = random_sub.title url = random_sub.url embed = Embed(title=name, colour=random.choice(colors)) embed.set_image(url=url) await Channel.send(embed=embed)
async def start_meetings(): global Active_meetings members = (x for x in client.get_all_members()) for x in members: if x.name in meetings.keys(): for y in meetings[x.name]: if y != None and y.active and y.time < datetime.now( ) and not y.started: y.started = True Active_meetings.append(x.id) channel = client.get_channel(807682739523682330) await channel.send( "Hello every one...Bo2loz here,\nThe " + y.topic + " meeting will start now so please enter the voice channel now.\nGood luck Team !!!" )
async def MakeNewMeeting(message): time = findall("[Tt]ime\s*:\s*[0-9][0-2]*:[0-9]{2}\s*[A|a|P|p][m|M],*", message.content.lower())[0] day = findall("[Dd]ay\s*:\s*\w+day\s*,*", message.content.lower())[0] location = findall("[Ll]ocation\s*:.+,*", message.content.lower())[0] topic = findall("[Tt]opic\s*:.+,*", message.content.lower())[0] time = time[time.index(':') + 1:time.index(',') if ',' in time else len(time)].strip() day = day[day.index(':') + 1:day.index(',') if ',' in day else len(day)].strip() location = location[location.index(':') + 1:location.index(',') if ',' in location else len(location)].strip() topic = topic[topic.index(':') + 1:topic.index(',') if ',' in topic else len(topic)].strip() for x in meetings[message.author.name]: if x.active == False: x.time = word_to_date(time, day) x.topic = topic x.active = True x.location = location x.confirmed.append(message.author.name) server = client.get_guild(SERVER_ID) categories = server.categories category = None for z in categories: if z.name == "Voice Channels": category = z await server.create_voice_channel(name=topic + " Voice meeting", category=category, overwrites=None, reason=None) for y in client.get_all_channels(): if y.name == topic + " Voice meeting": x.meeting_id = y.id SaveConfig() channel = client.get_channel(807682739523682330) await channel.send( 'Hello every one Bo2loz here\n' + message.author.name + ' Just created a meeting!!!\nmeeting location : ' + location + '\nmeeting time : ' + x.time.strftime("%c") + '\nmeeting topic :' + topic + '\nmeeting id : ' + str(x.meeting_id) + '\n\nif you have any excuses please send me a message containing the word excuse + meeting id + your excuse (example : excuse 123456789 I was sick)\nTo confirm send me a message containing the word confirm + meeting id (example : confirm 123456789)\n\nalways glad to help :nerd: :nerd: :nerd:' ) await message.channel.send( "meeting made successfully !\n your voice channel is ready !\n meeting id : " + str(x.meeting_id))
async def post_issues(): global current_issues issue_channel = client.get_channel(835993492807221278) headers = {'Authorization': GIT_HUB_TOKEN} new_issues = json.loads( requests.get( "https://api.github.com/repos/{org_name}/{repo_name}/issues?state=open", headers).content.decode()) for issue in new_issues: if issue in current_issues: pass else: await issue_channel.send( f":beetle: :beetle: NEW ISSUE :beetle: :beetle: {issue['created_at']}\n{issue['html_url']}" ) current_issues.append(issue)
async def on_voice_state_update(member, before, after): role = member.guild.get_role(822598861402013707) guild = client.get_guild(SERVER_ID) memberList = [] for user in guild.members: if role in user.roles: memberList.append(user.mention) for x in Active_meetings: voice_channel = client.get_channel(x) members = voice_channel.members membersVC = [] for member in members: if role in member.roles: membersVC.append(member.mention) for x in client.get_all_members(): if x.name in meetings.keys(): for y in meetings[x.name]: if y.active == True: if before.channel is None and after.channel is not None and role in member.roles: if after.channel.id == y.meeting_id: if member.mention in memberList: voice_channel = client.get_channel( y.meeting_id) users = voice_channel.members membersVC = [] for user in users: if role in member.roles: membersVC.append(user.mention) memberList = list( set(memberList) ^ set(memids)) memberList.remove(member.mention) embed = Embed( description=f"{member.mention} joined " + y.topic + " meeting voice channel", colour=Colour.green()) embed.set_footer( text= f"ID: {member.id} • {datetime.now()}" ) embed.set_author( name=member.display_name, icon_url=member.avatar_url) embed.add_field( name="Missing members", value=", ".join(memberList), inline=False) embed.add_field( name="Members in the meeting", value=", ".join(membersVC)) await client.get_channel( 822588656627089500).send(embed=embed) elif before.channel is not None and after.channel is None and role in member.roles: if before.channel.id == y.meeting_id: embed = Embed( description=f"{member.mention} left " + y.topic + " meeting voice channel", colour=Colour.red()) embed.set_footer( text=f"ID: {member.id} • {datetime.now()}" ) embed.set_author(name=member.display_name, icon_url=member.avatar_url) await client.get_channel(822588656627089500 ).send(embed=embed)