Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Discord Bot not working
#1
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")
Reply
#2
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.
Reply
#3
(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.
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.

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.
Reply
#4
to resolve this error line #14 needs to be indented 2 levels

class Main_Commands ():
    def __init__ (self, bot):
        self.bot = bot
Reply
#5
(Mar-18-2018, 09:17 PM)buran Wrote: to resolve this error line #14 needs to be indented 2 levels

class Main_Commands ():
    def __init__ (self, bot):
        self.bot = bot

still not working
Reply
#6
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Help discord bot Edward 0 2,059 Sep-15-2022, 09:55 PM
Last Post: Edward
  Discord Bot Dark_Sovereign_193 0 32,269 Jun-03-2021, 03:24 PM
Last Post: Dark_Sovereign_193
  Discord Bot Help Oshadha 0 1,383 Jan-26-2021, 04:23 PM
Last Post: Oshadha
  Creating Discord Bot: Unused import statement 'import discord EyeballCandy 0 3,515 Feb-02-2020, 10:53 PM
Last Post: EyeballCandy
  Discord Bot Arbys 7 27,136 Nov-06-2017, 03:36 PM
Last Post: Gamer
  discord bot not working lolteam 1 9,483 Aug-31-2017, 11:30 AM
Last Post: j.crater
  discord bot lolteam 1 6,022 Aug-31-2017, 08:57 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020