async def remind_members(): members = client.get_all_members() for x in members: if x.name in meetings.keys(): for y in meetings[x.name]: if (y.time - datetime.today()).days + 1 < 2: for z in client.get_all_members(): if not z.bot and z.name not in y.confirmed: message = "You did not confirm on the meeting shceduled on " + y.time.strftime( "%c" ) + " at " + y.location + "Please check it out in the meetings channel\n\nalways glad to help :nerd: :nerd: :nerd:" channel = await z.create_dm() await channel.send(message)
async def ExcuseMeeting(message): id = findall(r'[0-9]+', message.content.lower())[0] excuse = findall("[Ee][Xx][cC][Uu][Ss][Ee]\s*:.+", message.content.lower())[0] excuse = excuse[excuse.index(':') + 1:len(excuse)].strip() excuse = ''.join([i for i in excuse if not i.isdigit()]) for x in meetings: for y in meetings[x]: if y.active == True and y.meeting_id == int(id): for z in client.get_all_members(): if z.id == y.admin: channel = await z.create_dm() y.excuse[message.author.name] = excuse if message.author.name in y.confirmed: y.confirmed.remove(message.author.name) await channel.send(message.author.name + " said he cannot attend the " + y.topic + " meeting\nexcuse : " + excuse) await message.channel.send( "Your excuse has been submitted to the meeting host\nSorry to hear that :sob:" ) SaveConfig() return return
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 ConfirmMeeting(message): id = int(findall(r'[0-9]+', message.content.lower())[0]) for x in meetings: for y in meetings[x]: if y.active == True and y.meeting_id == id and message.author.name not in y.confirmed: for z in client.get_all_members(): if z.id == y.admin: channel = await z.create_dm() y.confirmed.append(message.author.name) if message.author.name in y.excuse.keys(): y.excuse.pop(message.author.name, None) await channel.send(message.author.name + "has confirmed the " + y.topic + " meeting") await message.channel.send("Confirmation Successfull") SaveConfig() return return
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)