How to Make a Discord Bot with Python

Поделиться
HTML-код
  • Опубликовано: 17 янв 2025

Комментарии • 111

  • @zzz-oc4fe
    @zzz-oc4fe 2 года назад +16

    Just found your channel. Watched the AI SaaS video and am now on the portfolio site for beginners. The level of detail you put into explaining things in your videos is just right. Please keep making content, thanks a lot.

    • @pixegami
      @pixegami  2 года назад +2

      😅 Thanks for your kind works. It is a challenge for me to balance the content to be fast and simple, but still comprehensive enough to learn from, so hearing that it works for you is very encouraging!

    • @rachit.6110
      @rachit.6110 2 года назад

      @@pixegami you're a great teacher please continue this course

  • @ArunWills7
    @ArunWills7 Год назад +8

    the only tutorial that actually works, thanks a ton!

  • @akuan195
    @akuan195 2 года назад +4

    you are awesome, this is the only one tutorial that works for me

    • @pixegami
      @pixegami  2 года назад

      Glad to hear that!

  • @AlexTsaava
    @AlexTsaava 4 месяца назад

    the first video i saw on your channel your skills with discord really impressed me

  • @SIMP_Toast87
    @SIMP_Toast87 Год назад +1

    Best tutorial!❤

  • @Daraca5
    @Daraca5 Год назад +1

    Thank you! this was great, half the battle with things like this is getting the thing to run to begin with, so you've gotten me that far, much better tutorial than all the rest I've come across.

    • @pixegami
      @pixegami  Год назад

      Awesome! Glad to hear it was useful :)

  • @AudreyGB
    @AudreyGB 10 месяцев назад +1

    Great tutorial! Thanks a lot!

    • @pixegami
      @pixegami  10 месяцев назад

      You're welcome!

  • @Maple38
    @Maple38 Год назад +5

    Great tutorial. I looked through a lot of them, and while they worked, none of them really explained why they did stuff. They just wrote code and expected to follow.

    • @pixegami
      @pixegami  Год назад +1

      Thanks for that feedback! It's something I actively try to achieve in my tutorials, so I'm glad it's coming across.

  • @B1oodbeard
    @B1oodbeard 11 месяцев назад +1

    This helped so much to get started

    • @pixegami
      @pixegami  11 месяцев назад +1

      Glad to hear it. Thank you!

  • @jason6569
    @jason6569 10 месяцев назад +1

    This was exactly what I needed. Got it running in 10 minutes and coded what I needed. My one issue, and I know it isn't part of this is how to limit the bot to one channel! I did start it as administrator to test. Removed it and readded it with just manage and send messages in text permissions. Google is not helping and I am stumped. I don't want everyone to use my / commands! Just a specific channel.
    Again great tutorial, it did what it was supposed to! Thank you!

    • @pixegami
      @pixegami  10 месяцев назад

      Thank you! To solve your problem, here is one solution I found online:
      > The easiest way to do this is not actually via code but via permissions on the server. On your server you should find a role with the same name as your bot, whose permissions (including send messages) you can change for seperate channels.
      Otherwise, I guess you can do it hackily as well by using an if/else statement in the bot logic itself to only respond if the channel ID of the message is the one you want the bot to operate in.

  • @katerinejaimes6585
    @katerinejaimes6585 Год назад +1

    Justo lo que necesitaba, me gusta como explica todo mjuy bien, aunque es en ingles es un reto tambien porque estoy aprendiendo asi que es un Plus. Muchas gracias. Una suscriptora mas 😊

    • @pixegami
      @pixegami  Год назад +1

      Thank you! I'm glad you enjoyed it. I hope you were able to understand the video :)

  • @novaplatoon5982
    @novaplatoon5982 2 года назад +3

    hey when I tried doing the command it would not respond 14:37

    • @justecho5760
      @justecho5760 Год назад +1

      relatable

    • @jordantaylor5302
      @jordantaylor5302 Год назад +1

      same

    • @jordantaylor5302
      @jordantaylor5302 Год назад

      jk make sure when you declare your "!" thing theres no spaces like "! " or " !" this saved me hours and worked after i noticed i had a space of some sort

  • @happytwo58
    @happytwo58 Месяц назад +1

    it says the term pip isn't recognized

    • @MrJerrylikes
      @MrJerrylikes Месяц назад

      When you download python you also download pip. So if pip is not recognized either you did not install python correctly or PATH was not created correctly and your terminal is not recognizing the PIP file. Go to the terminal and type the comand python it should grab your python file. Let me know what it says.

    • @actually_blaze
      @actually_blaze Месяц назад

      @@MrJerrylikes it opens a microsoft store page

  • @kingking7698
    @kingking7698 2 года назад +2

    Thank you for the awesome video!!

  • @MindUnearthed
    @MindUnearthed Год назад +4

    when I want to install the 'pip install discord.py' error comes in and it says "which is required to install pyproject.toml-based projects" how do I make it install ?

  • @gavinosegura4865
    @gavinosegura4865 Год назад +4

    i copied text by text to just have the bot print hello on the discord and i keep running into issues with on ready await channel.send Attribute error with python. Any suggestions?

    • @pixegami
      @pixegami  Год назад

      Hmm, I checked the code recently and it was still working. What is the exact error and what version of discord.py are you using?

    • @maheerhuq6708
      @maheerhuq6708 5 месяцев назад

      Whats the fix?????

  • @nileshswami2426
    @nileshswami2426 2 года назад +1

    Thank you🤩

    • @pixegami
      @pixegami  2 года назад

      You’re welcome 😊

  • @Dhanush10101
    @Dhanush10101 10 месяцев назад +1

    Thanks for this video bro it's working with no issues and I got some idea about it once again thank you it's very useful to me ❤❤❤ but can you help me with in 20:41 i'm still can't figure it out to print the timer

    • @pixegami
      @pixegami  10 месяцев назад

      Thanks! Glad it's useful. What issue are you having with printing out the timer?

    • @Dhanush10101
      @Dhanush10101 10 месяцев назад

      @@pixegami ​ Hey thanks for your replay , so im a Beginner for python i cannot figure out the ' end session's end timer like human readable time and why are you using timedelta(seconds = duration)

  • @dogereacts1271
    @dogereacts1271 Год назад +2

    my bot won't work and the error message has a problem with the async. do u know how to fix that?

    • @pixegami
      @pixegami  Год назад

      Sorry I'm not sure, it's been a quite since I worked on this. What's the error message say exactly?

    • @dogereacts1271
      @dogereacts1271 Год назад

      @@pixegamithis was the error message
      File "bot.py", line 11
      async def on_ready():
      ^
      SyntaxError: invalid syntax

    • @dogereacts1271
      @dogereacts1271 Год назад

      do u know what it means? I'm clueless

    • @Unpluggedx89
      @Unpluggedx89 Год назад

      @@dogereacts1271What version of python were you using?

    • @dogereacts1271
      @dogereacts1271 11 месяцев назад

      @@Unpluggedx89 the newest

  • @byhelvete4757
    @byhelvete4757 2 месяца назад

    What extensions are you using while coding this?

  • @davudhaci5379
    @davudhaci5379 Год назад +2

    Which exintension are u use for complate code

  • @homerovignecarpi8913
    @homerovignecarpi8913 9 месяцев назад +1

    THANKS A LOT MAN, YOU WERE OF GREAT HELP!!!!

    • @pixegami
      @pixegami  9 месяцев назад

      You're welcome!

  • @LavinOficial
    @LavinOficial 7 месяцев назад

    great video, direct and precise, I just want to ask you what happens if I want to give each user an ID, what would the logic be?

  • @AloneNinja36
    @AloneNinja36 Год назад +1

    How can I make my Discord bot only appear in one channel and not work in other channels?

    • @pixegami
      @pixegami  Год назад +1

      You can add a condition into the functions so it only does things in a specific channel:
      "if message.channel.id == YOUR_CHANNEL_ID: ..."

  • @78wesley67
    @78wesley67 2 года назад +2

    Which add-on do you use for auto generating code?

    • @pixegami
      @pixegami  2 года назад

      GitHub Copilot. I actually talk about it in this video: ruclips.net/video/tG8PPne7ef0/видео.html

  • @Alw1130
    @Alw1130 Год назад +1

    When I start a study session, the time is 5 hours later than intended. What is the fix for that?

    • @pixegami
      @pixegami  Год назад

      It probably uses the UTC time from the machine your bot is running on. What’s the timezone set on your system?
      You might have to set it to local time.

  • @lukli425
    @lukli425 8 месяцев назад +1

    It doesnt run for me and It cant resolve discord dot ext

    • @pixegami
      @pixegami  8 месяцев назад

      Hmm, it could be because you might be using a newer version of the Discord library than what I used in the video, or you have it pointed to the wrong Python environment.

  • @jaixxo
    @jaixxo 2 месяца назад

    how do you do it in all channels?

  • @Filaskon
    @Filaskon 9 месяцев назад

    So helpful :D this tutorial is perfect bc i need a bot that runs a command every 24 hrs bc im lazy lol

  • @retrokjay997
    @retrokjay997 Год назад

    do you know how to get the prizepick projections?

  • @marcoshocpfner9184
    @marcoshocpfner9184 2 года назад +1

    Thank for this... very useful, do you have enything about on discord bot whit cli AWC ?

    • @pixegami
      @pixegami  2 года назад +1

      Not at the moment, but I plan to do more Discord videos in the future.

  • @spooky-
    @spooky- Год назад +1

    my bot wont come online, ive check my code and token multipul times (im on mac)

    • @pixegami
      @pixegami  Год назад

      What error do you see?

  • @openup8708
    @openup8708 6 месяцев назад

    hey great video. i have a question. If I have code written already, how do I implement that code to work with the discord bot? For example, if I have a script written to return output for a certain input, how do I implement this to the discord bot so that if i place an input to the discord channel, it will output the values (from my script I created)

  • @theOtherGuy2175
    @theOtherGuy2175 2 года назад +1

    Is there a way to have a catch all async def? Like if someone types /bot

    • @pixegami
      @pixegami  2 года назад +1

      No idea! I looked it up and found this:
      @bot.event
      async def on_command_error(ctx, error):
      await ctx.send(f"An error occured: {str(error)}")
      From stackoverflow.com/questions/62771154/discord-py-rewrite-sending-an-error-message-when-there-is-an-unknown-command-or

  • @heckor8128
    @heckor8128 2 года назад +1

    why does it show me
    [Done] exited with code=0 in 0.092 seconds
    after i do client.run(token) instead of showing my bot online

    • @joao_silva679
      @joao_silva679 2 года назад +1

      If you did exactly as he did, you should use bot.run(token) instead of client.

  • @xinyangwang6422
    @xinyangwang6422 5 месяцев назад

    I can log in with client and see my user name (bot #...), but I can't see any channel at all. I can see the bot in server settings though. Do you maybe know why?

  • @ConsCrafter
    @ConsCrafter 6 месяцев назад

    which IDE is he using ?

  • @parrrkkkk
    @parrrkkkk 2 года назад

    im having this problem:
    AttributeError: 'NoneType' object has no attribute 'send'

    • @pixegami
      @pixegami  2 года назад

      What's the full stack trace? Did you initialize your bot properly?

    • @parrrkkkk
      @parrrkkkk 2 года назад

      @@pixegami no its ok now

    • @maheerhuq6708
      @maheerhuq6708 5 месяцев назад

      @@parrrkkkk What did udo

    • @parrrkkkk
      @parrrkkkk 5 месяцев назад

      @@maheerhuq6708 i posted this a year ago

  • @fumingstargaming2508
    @fumingstargaming2508 Год назад +1

    I need help can i join your dc pls gimme link

    • @pixegami
      @pixegami  Год назад

      Sorry I don't have a public Discord channel yet. I'll post an update if I do get around to making one.

  • @solo_zither6365
    @solo_zither6365 Год назад +1

    you are a god

  • @Manciek_
    @Manciek_ Год назад

    Any idea why commands doesnt work with my bot? It doesnt recognize that i typed $hello

    • @pixegami
      @pixegami  Год назад

      Hmm, is it possible the Discord API version changed? Compare the version of Discord to the one being used in the video (although I'm not sure if I actually show it in there)...

    • @Manciek_
      @Manciek_ Год назад

      @@pixegami nvm I just found out that .bot.event on_message() ovverite commands 😅

  • @XaskyShow
    @XaskyShow 2 года назад

    Why that's not work on manjaro?

    • @pixegami
      @pixegami  2 года назад

      No idea... What error do you see?

    • @XaskyShow
      @XaskyShow 2 года назад

      @@pixegami no error, just not work.

    • @XaskyShow
      @XaskyShow 2 года назад

      @@pixegami he just don't making anything when typing command.

  • @SuperLimeWorld
    @SuperLimeWorld 9 месяцев назад +1

    It never prints the text when I run it!
    Edit:
    so it turns out it has to named 'on_ready' lmao
    "which thing has to be named on_ready?":
    Watch the tutorial, if you see something named "on_ready", don't change it, otherwise, it fails.

    • @pixegami
      @pixegami  9 месяцев назад

      Thanks for sharing the solution :)

    • @SuperLimeWorld
      @SuperLimeWorld 8 месяцев назад

      @@pixegami Np :3

    • @Meowicat
      @Meowicat 7 месяцев назад

      could you elaborate on this? which thing has to be named on_ready?

    • @SuperLimeWorld
      @SuperLimeWorld 7 месяцев назад

      @@Meowicat I have updated my comment to answer your question

  • @hellonearth311
    @hellonearth311 Год назад

    it doesnt work bruh. apparently some "ssl certificate error"

    • @pixegami
      @pixegami  Год назад

      What's the full error?

    • @hellonearth311
      @hellonearth311 Год назад

      i uhh deleted the code now but i was getting the same error with sending emails in python and i created an unverified context using the ssl lib. we don't use that here so i probably have no way to fix it and i honestly dont really wanna make a bot anymore. thanks for the attention to people with errors i really appreciate it! i'll check out your other videos/tutorials.

  • @Theposhestcat
    @Theposhestcat Год назад

    does this work with pycharm?

  • @rachit.6110
    @rachit.6110 2 года назад +1

    Please continue this cource! Also please tell us everything from Discord api documentation and all of the bot commands available there please.

  • @Drk-Inky
    @Drk-Inky 9 месяцев назад

    i need pysilon discord

  • @spionzentauer
    @spionzentauer Год назад

    it says for me
    bot = commands.Bot(command_prefix="/", intents=discord.intents.all())
    AttributeError: module 'discord' has no attribute 'intents'
    how do I fix this

    • @pixegami
      @pixegami  Год назад

      I think you might be using a different discord.py version than the one used in the tutorial. You'd either have to roll back to the same version, for find the equivalent to "discord.intents.all()" in your current library version.

  • @juliodiaz9093
    @juliodiaz9093 Год назад

    im trying this tutorial but when i ise the command, theres no response. the async function doesnt even run.

    • @pixegami
      @pixegami  Год назад

      It's possible that the Discord package may have changed or been updated since the video was made :(

  • @bongobears673
    @bongobears673 6 месяцев назад

    hey, it says that there is not module named discord. can you help?

    • @bongobears673
      @bongobears673 6 месяцев назад

      nevermind i got it working

    • @pixegami
      @pixegami  2 месяца назад

      Ah, looks like you might not have the discord.py library installed yet. Try running 'pip install discord.py' in your command prompt or terminal. If you're still stuck, check out the GitHub repo for the full setup instructions: github.com/pixegami/simple-discord-bot. Let me know if that helps!