3 from coldcall import ColdCall
8 ## create the coldcall object
11 class ColdCallBot (discord.Client):
12 async def on_ready(self):
13 print(f'Logged on as {self.user}! Ready for class!')
15 async def on_message(self, message, voice_channel = 'Class Sessions'):
16 if message.author == self.user:
19 if message.content.startswith('$next'):
20 if message.channel.category:
21 if cc.course != message.channel.category:
22 cc.update_course(message.channel.category)
23 classroom = [x for x in message.guild.voice_channels if x.name == voice_channel and x.category_id == message.channel.category_id][0]
26 for member in classroom.members:
27 if 'Students' in [r.name for r in member.roles]:
28 present_students.append(re.sub(r'^(.*)\#.*$', r'\1', member.name))
31 print(f'currently online: {",".join(present_students)}')
33 if len(present_students) < 1:
34 msg_text = "I don't see any students currently in the Classroom Voice channel!"
38 msg_text = cc.coldcall(present_students)
40 await message.channel.send(msg_text)
42 # this is necessary to get information about who is online
43 intents = discord.Intents.default()
44 intents.members = True
45 intents.presences = True
47 ccb = ColdCallBot(intents=intents)