Ejemplo n.º 1
0
async def nextClass(ctx, identifier):
    if identifier == 'class':
        isSchool = True
        if classStuff.findDayType() == 'No School':
            await ctx.send('There is no school today')
            isSchool = False
        now = datetime.datetime.now()
        if now.time() > ENDOFSCHOOL:
            await ctx.send('School is over')
            isSchool = False
        timeTill = classStuff.timeTillNextClass(ADayTimes, NormalTimes)
        period = timeTill[1]
        time = timeTill[0]
        if isSchool:
            if time < 60:
                msg = '{} is starting in {} minutes'.format(period, time)
                await ctx.send(msg)
            else:
                time = converTimeMins(time)
                hours = time[0]
                minutes = time[1]
                msg = '{} is starting in {} hours and {} minutes'.format(
                    period, hours, minutes)
    else:
        await ctx.send("idk what you're talking about")
async def classCheck():
    await bot.wait_until_ready()
    message_channel = bot.get_channel(message_channel_id)
    message_channel2 = bot.get_channel(message_channel_id2)
    testMessageSent = False
    
    while reminder and not bot.is_closed() and classStuff.findDayType() != 'No School':
        if not testMessageSent:
            await message_channel2.send("i'm checking for class times")
            testMessageSent = True       
        isItTime = classStuff.timeCheck(buffer,ADayTimes,NormalTimes)
        isTime = isItTime[0]
        
        if isTime:
            classPeriod = isItTime[1]
            classTime = isItTime[2]
            if classStuff.findDayType() == 'A':
                classLength = datetime.timedelta(minutes=30)
            else:
                classLength = datetime.timedelta(minutes=40)
            classEnd = classTime + classLength
            BoT = discord.utils.get(theGuild.roles, name='Bastards on Time')
            E_reminder = discord.utils.get(theGuild.roles, name="So You Couldn't Be Bothered to Remember")
            await message_channel.send('{} About {} minutes left till {}, {} will end at {}!'. format(BoT.mention, buffer, classPeriod, classPeriod, classEnd.strftime('%I:%M')))
            if classStuff.findDayType() == 'A':
                sleepMins=30
            else:
                sleepMins=40
            log('start class check')
            await asyncio.sleep(sleepMins*60+buffer*60)
            nextClass = classStuff.timeTillNextClass(ADayTimes,NormalTimes)

            closestTime = nextClass[2].strftime('%I:%M')
            if nextClass[0] < 30:
                ending = 'chop chop!'
            else:
                ending = "you've got some time to relax"
            await message_channel.send('{} {} just ended and {} is starting in {} minutes at {} so {}'. format(E_reminder.mention, classPeriod, nextClass[1], nextClass[0],closestTime, ending))
            log('end class check')
        await asyncio.sleep(30)
async def schedule(ctx):
    embed = discord.Embed(title='Schedule for today', description='',color=0xff3e96)
    if classStuff.findDayType() != 'No School':
        schedule = classStuff.findSchedule()

        if classStuff.findDayType() == 'A':
            for item in ADayTimes:
                hour = classStuff.matchPeriod(item[0])
                startTime = item[1]
                endTime = startTime + datetime.timedelta(minutes=30)
                embed.add_field(name=hour,value='from {} to {}'. format(startTime.strftime('%I:%M'), endTime.strftime('%I:%M')), inline=False)
        elif classStuff.findDayType() == 'No School':
            await ctx.send("There's no school today")
        else:
            for item in NormalTimes:
                hour = classStuff.matchPeriod(item[0])
                startTime = item[1]
                endTime = startTime + datetime.timedelta(minutes=40)
                embed.add_field(name=hour,value='from {} to {}'. format(startTime.strftime('%I:%M'), endTime.strftime('%I:%M')), inline=False)
        await ctx.send(embed=embed)
    else:
        await ctx.send("There's no school today")
    log('schedule')
Ejemplo n.º 4
0
async def classCheck():
    await bot.wait_until_ready()
    message_channel = bot.get_channel(message_channel_id)
    message_channel2 = bot.get_channel(message_channel_id2)
    testMessageSent = False
    while reminder and not bot.is_closed(
    ) and classStuff.findDayType() != 'No School':
        if not testMessageSent:
            await message_channel2.send("i'm checking for class times")
            testMessageSent = True
        isItTime = classStuff.timeCheck(buffer, ADayTimes, NormalTimes)
        isTime = isItTime[0]
        classPeriod = isItTime[1]
        if isTime:
            print('class time should be working')
            await message_channel.send(
                '@everyone About {} minutes left till {}!'.format(
                    buffer, classPeriod))
            await asyncio.sleep(buffer * 60)
        await asyncio.sleep(60)
Ejemplo n.º 5
0
async def getDate(ctx):
    await bot.wait_until_ready()
    date = classStuff.getDateTime('Date')
    await ctx.send('{} It is an {} day'.format(date, classStuff.findDayType()))