def setup(bot: CustomClient): bot.add_cog(Credit(bot))
def setup(bot: CustomClient): bot.add_cog(Dev(bot))
def setup(bot: CustomClient): bot.add_cog(GuildSetup(bot))
(message.guild.id, ))) guild_prefix = data[0]["prefix"] except IndexError: await jbot_db_global.exec_sql( "INSERT INTO guild_setup(guild_id) VALUES (?)", (message.guild.id, )) data = (await jbot_db_global.res_sql( """SELECT prefix FROM guild_setup WHERE guild_id=?""", (message.guild.id, ))) guild_prefix = data[0]["prefix"] return commands.when_mentioned_or(*['제이봇 ', 'j!', guild_prefix])(bot, message) bot = CustomClient(command_prefix=get_prefix, help_command=None, allowed_mentions=discord.AllowedMentions(everyone=False), intents=discord.Intents.all()) if bot.get_bot_settings()["debug"]: print("Bot running in debug mode.") async def is_whitelisted(ctx): if ctx.author.id in bot.get_bot_settings()["whitelist"]: return True raise custom_errors.NotWhitelisted @bot.event async def on_ready(): shards = bot.shard_ids
def setup(bot: CustomClient): bot.add_cog(Admin(bot))
def setup(bot: CustomClient): bot.add_cog(Game(bot))
def setup(bot: CustomClient): bot.add_cog(Help(bot))
def setup(bot: CustomClient): bot.add_cog(EasterEgg(bot))
async def queue_task(bot: CustomClient, ctx: commands.Context, voice: discord.VoiceClient): while True: exists = os.path.isfile(f"music/{ctx.guild.id}.json") if not exists: await ctx.send(f"`{voice.channel}`에서 나갈께요.") await voice.disconnect(force=True) break queue = await get_queue(ctx.guild.id) if voice.is_playing() or voice.is_paused(): await asyncio.sleep(1) continue elif not voice.is_playing() and len( queue.keys()) == 1 and queue["playing"]["loop"] is not True: await ctx.send(f"음악이 끝났어요. `{voice.channel}`에서 나갈께요.") await voice.disconnect(force=True) os.remove(f"music/{ctx.guild.id}.json") break vol = queue["playing"]["vol"] if queue["playing"]["loop"] is True: tgt_url = queue["playing"]["tgt_url"] voice.play( discord.FFmpegPCMAudio(tgt_url, before_options=get_youtube.before_args)) voice.source = discord.PCMVolumeTransformer(voice.source) voice.source.volume = vol await asyncio.sleep(3) continue if queue["playing"]["random"]: queue_keys = [str(x) for x in queue.keys() if not x == "playing"] tgt_name = str(random.choice(queue_keys)) tgt_queue = queue[tgt_name] else: tgt_name = list(queue.keys())[1] tgt_queue = queue[tgt_name] vid_url = tgt_queue["vid_url"] vid_title = tgt_queue["vid_title"] vid_author = tgt_queue["vid_author"] vid_channel_url = tgt_queue["vid_channel_url"] tgt_url = tgt_queue["tgt_url"] thumb = tgt_queue["thumb"] req_by = bot.get_user(int(tgt_queue["req_by"])) voice.play( discord.FFmpegPCMAudio(tgt_url, before_options=get_youtube.before_args)) voice.source = discord.PCMVolumeTransformer(voice.source) voice.source.volume = vol embed = discord.Embed(title="유튜브 음악 재생", color=discord.Colour.from_rgb(255, 0, 0)) embed.add_field( name="재생 시작", value= f"업로더: [`{vid_author}`]({vid_channel_url})\n제목: [`{vid_title}`]({vid_url})", inline=False) embed.add_field(name="요청자", value=f"{req_by.mention} (`{req_by}`)", inline=False) embed.set_image(url=str(thumb)) queue["playing"]["vid_url"] = vid_url queue["playing"]["vid_title"] = vid_title queue["playing"]["vid_author"] = vid_author queue["playing"]["vid_channel_url"] = vid_channel_url queue["playing"]["thumb"] = thumb queue["playing"]["tgt_url"] = tgt_url queue["playing"]["req_by"] = tgt_queue["req_by"] await ctx.send(embed=embed) del queue[tgt_name] await update_queue(ctx.guild.id, queue) await asyncio.sleep(3)