3 from coldcall import ColdCall
7 ## create the coldcall object
10 class ColdCallBot (discord.Client):
11 async def on_ready(self):
12 print(f'Logged on as {self.user}! Ready for class!')
14 async def on_message(self, message):
15 if message.author == self.user:
18 if message.content.startswith('$next'):
19 classroom = discord.utils.get(message.guild.voice_channels, name='Classroom Voice')
22 for member in classroom.members:
23 if 'Students' in [r.name for r in member.roles]:
24 present_students.append(re.sub(r'^(.*)\#.*$', r'\1', member.name))
27 print(f'currently online: {",".join(present_students)}')
29 if len(present_students) < 1:
30 msg_text = "I don't see any students currently in the Classroom Voice channel!"
32 msg_text = cc.coldcall(present_students)
34 await message.channel.send(msg_text)
36 # this is necessary to get information about who is online
37 intents = discord.Intents.default()
38 intents.members = True
39 intents.presences = True
41 ccb = ColdCallBot(intents=intents)