Discord Bot not working - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Discord Bot not working (/thread-9041.html) |
Discord Bot not working - SoulWolfX - Mar-18-2018 For some reason once I added a music function to my discord bot it stopped working, can anyone tell me why? My code is; # FangBot by SoulWolfX#1057 https://www.youtube.com/c/SoulWolfGamer for wolfnation startup_extensions = ["Music"] bot = commands.Bot(command_prefix='-') @bot.event async def on_ready(): print ("FangBot innitialized. hello wolfnation") class Main_Commands (): def __init__ (self, bot): self.bot = bot @client.event async def wait_until_login(): await client.change_presence(game=discord.Game(name='WolfNation bot made by http://bit.ly/2EzoA8e')) @bot.command(pass_context=True) async def ping(ctx): await bot.say(":ping_pong: Pong") print ("user has pinged") async def pong(ctx): await bot.say(":ping_pong: Ping") print ("user has ponged") @client.command(pass_context=True) async def yt(ctx): url = ctx.message.content url = url.strip('!yt ') author = ctx.message.author voice_channel = author.voice_channel vc = await client.join_voice_channel(voice_channel) player = await vc.create_ytdl_player(url) player.start() @bot.command(pass_context=True) async def info(ctx, user: discord.Member): await bot.say("The users name is (and no its not john cena): {}".format(user.name)) await bot.say("The users ID is: {}".format(user.id)) await bot.say("The users status is: {}".format(user.status)) await bot.say("The users rank is: {}".format(user.top_role)) await bot.say("The user joined at: {}".format(user.joined_at)) @bot.command(pass_context=True) async def kick(ctx, user: discord.Member): await bot.say(":boot: Cya, {}. don't wanna be ya.".format(user.name)) await bot.kick(user) @bot.command(pass_context=True) async def ban(ctx, user: discord.Member): await bot.say(":hammer: Dirty cheater {}. FACE THORS MIGHTY BAN HAMMER!".format(user.name)) await bot.ban(user) if __name__ == "__main__": for extension in startup_extension(extension) except Exception as e: exc = '{}: {}'.format(type(e).__name__, e) print('Failed to load extension {}\n{}'.format(extension, exc)) await client.change_presence(game=discord.Game(name="WolfNation bot made by http://bit.ly/2EzoA8e")) bot.run("PLACEHOlDER SO NO ONE STEALS MY BOT TOKEN") RE: Discord Bot not working - j.crater - Mar-18-2018 Unless there is a Discord bot expert on this forum (personally I am not aware of any), it is unlikely that we could help. However if the issue is with Python, and you can provide any meaningful error message or description of what is going on, then someone may be able to help. RE: Discord Bot not working - SoulWolfX - Mar-18-2018 (Mar-18-2018, 08:29 PM)j.crater Wrote: Unless there is a Discord bot expert on this forum (personally I am not aware of any), it is unlikely that we could help. C:\Users\SoulW\Desktop\Discord>C:\Users\SoulW\Desktop\Discord\Fang-Bot\bot.py File "C:\Users\SoulW\Desktop\Discord\Fang-Bot\bot.py", line 14 self.bot = bot ^ IndentationError: expected an indented block C:\Users\SoulW\Desktop\Discord> that's the error if I run it via cmd. RE: Discord Bot not working - buran - Mar-18-2018 to resolve this error line #14 needs to be indented 2 levels class Main_Commands (): def __init__ (self, bot): self.bot = bot RE: Discord Bot not working - SoulWolfX - Mar-18-2018 (Mar-18-2018, 09:17 PM)buran Wrote: to resolve this error line #14 needs to be indented 2 levels still not working RE: Discord Bot not working - buran - Mar-19-2018 Not working is not very informative. My advice was for the error you post. Post the full traceback you get now in error tags. Obviously there are still other problems |