Open eric-yeung opened 3 years ago
you should be able to host 24/7 the bot using replit and uptimerobot. If you need help dm me on discord: ValenArb#2507
Bot online Ignoring exception in command play: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 855, in invoke await self.prepare(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 789, in prepare await self._parse_arguments(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 697, in _parse_arguments transformed = await self.transform(ctx, param) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 542, in transform raise MissingRequiredArgument(param) discord.ext.commands.errors.MissingRequiredArgument: url is a required argument that is missing. Ignoring exception in command join: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "main.py", line 30, in join voice = await channel.connect() File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/abc.py", line 1277, in connect voice = cls(client, self) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/voice_client.py", line 199, in init raise RuntimeError("PyNaCl library needed in order to use voice") RuntimeError: PyNaCl library needed in order to use voice
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, *ctx.kwargs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice Ignoring exception in command join: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(args, **kwargs) File "main.py", line 30, in join voice = await channel.connect() File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/abc.py", line 1277, in connect voice = cls(client, self) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/voice_client.py", line 199, in init raise RuntimeError("PyNaCl library needed in order to use voice") RuntimeError: PyNaCl library needed in order to use voice
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice Ignoring exception in command clear: Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 467, in _actual_conversion return converter(argument) ValueError: invalid literal for int() with base 10: '4`'
Help
Help
It looks like you need to download the dependencies
Help
It looks like you need to download the dependencies
Sorry I didn't see that It works BTW can you give your Discord ID I need to ask a few things
Traceback (most recent call last):
File "C:\Users\user\Desktop\Discord-Bot-master\main.py", line 92, in
help please
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\Discord bots\main.py", line 8, in
Traceback (most recent call last): File "C:\Users\user\PycharmProjects\Discord bots\main.py", line 8, in from discord import TextChannel ImportError: cannot import name 'TextChannel' from 'discord' (C:\Users\user\PycharmProjects\Music bot\venv\lib\site-packages\discordinit.py)
help?
Traceback (most recent call last): File "C:\Users\user\PycharmProjects\Discord bots\main.py", line 8, in from discord import TextChannel ImportError: cannot import name 'TextChannel' from 'discord' (C:\Users\user\PycharmProjects\Music bot\venv\lib\site-packages\discordinit.py)
help?
Can you show the code please?
Traceback (most recent call last): File "C:\Users\user\PycharmProjects\Discord bots\main.py", line 8, in from discord import TextChannel ImportError: cannot import name 'TextChannel' from 'discord' (C:\Users\user\PycharmProjects\Music bot\venv\lib\site-packages\discordinit.py)
help?
Can you show the code please?
import discord import os
from dotenv import load_dotenv from discord.ext import commands from discord.utils import get from discord import FFmpegPCMAudio from discord import TextChannel from youtube_dl import YoutubeDL
load_dotenv() client = commands.bot(command_prefix = '~')
players = {}
@client.event async def on_ready(): print('Bot online')
@client.command() async def join(ctx): channel = ctx.message.author.voice.channel voice = get(client.voice_clients, guild=ctx.guild) if voice and voice.is_connected(): await voice.move_to(channel) else: voice = await channel.connect()
@client.command() async def play(ctx, url): YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'} FFMPEG_OPTIONS = { 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'} voice = get(client.voice_clients, guild=ctx.guild)
if not voice.is_playing():
with YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
URL = info['url']
voice.play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
voice.is_playing()
await ctx.send('Bot is playing')
else:
await ctx.send("Bot is already playing")
return
@client.command() async def resume(ctx): voice = get(client.voice_clients, guild=ctx.guild)
if not voice.is_playing():
voice.resume()
await ctx.send('Bot is resuming')
@client.command() async def pause(ctx): voice = get(client.voice_clients, guild=ctx.guild)
if voice.is_playing():
voice.pause()
await ctx.send('Bot has been paused')
@client.command() async def stop(ctx): voice = get(client.voice_clients, guild=ctx.guild)
if voice.is_playing():
voice.stop()
await ctx.send('Stopping...')
@client.command() async def clear(ctx, amount=5): await ctx.channel.purge(limit=amount) await ctx.send("Messages have been cleared")
client.run(os.getenv('TOKEN'))