import discord import sound import asyncio import datetime from discord.ext import commands DEVICE_NAME = "VoiceMeeter Output" BOT_TOKEN = 'OTE1MDY0OTk2OTk0NjMzNzI5.YaWKsA.Y9yaCGg_VXRL_qQVbs05vo7gSAc' bot = commands.Bot(command_prefix='>') async def bg_timer(): await bot.wait_until_ready() channel = bot.get_channel(id=757379843792044102) while not bot.is_closed(): guild = channel.guild role_id = discord.utils.get(guild.roles, name='Superadmins').id willie_time = ("04:20:00", "00:16:00") print(guild.roles) time_now = datetime.datetime.now() time_now_str = f"{time_now.strftime('%H:%M')}:00" print(role_id) if 1: #time_now_str in willie_time: await channel.send(f"<@{role_id}> hello") print("yes") await asyncio.sleep(30) @bot.command() async def ping(ctx): await ctx.send('pong') @bot.command() async def join(ctx): await bot.wait_until_ready() discord.opus.load_opus('./opus/libopus.dll') if discord.opus.is_loaded(): stream = sound.PCMStream() channel = ctx.author.voice.channel for device, index in sound.query_devices().items(): print(index, device) if DEVICE_NAME in device: stream.change_device(index) break voice_connection = await channel.connect() voice_connection.play(discord.PCMAudio(stream)) else: await ctx.send("Opus won't load") @bot.command() async def leave(ctx): await ctx.voice_client.disconnect() #Enable below for 420 timer #bot.loop.create_task(bg_timer()) bot.run(BOT_TOKEN)