if message.content.stratswith("%hello"): the error say AttributeError: 'str' object has no attribute 'stratswith please help
Traceback (most recent call last): File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/ TOKEN=OTYzMTg5MDU1MDYxODg1MDU4.YlSdtQ.8mRKRG3CmHW7AGdvHOK0lZm4qp0 Traceback (most recent call last): File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/http.py", line 300, in static_login data = await self.request(Route('GET', '/users/@me')) File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/http.py", line 254, in request raise HTTPException(r, data) discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "main.py", line 22, in client.run(os.getenv('token')) File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/client.py", line 723, in run return future.result() File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/client.py", line 702, in runner await self.start(*args, **kwargs) File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/client.py", line 665, in start await self.login(*args, bot=bot) File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/client.py", line 511, in login await self.http.static_login(token.strip(), bot=bot) File "/home/runner/helper-bot/venv/lib/python3.8/site-packages/discord/http.py", line 304, in static_login raise LoginFailure('Improper token has been passed.') from exc discord.errors.LoginFailure: Improper token has been passed.
sleepy boi
This tutorial really helped me getting through the first steps of the bot, but sadly most of the code is outdated. If you still aim to use this bot as a learning experiences for future students, perhaps you should update it? Either way, this bot taught me a lot about programming bots in general and for that I am very thankful! =)
Dude its not working
how do u do the keepalive cause it aint working for me
from flask import Flask from threading import Thread
app = Flask('')
@app.route('/') def home(): return "Hello. I am alive!"
def run(): app.run(host='0.0.0.0',port=8080)
def keep_alive(): t = Thread(target=run) t.start()
Why is it not waking up????
Wake up repl
trouble?
um its sleeping
This is super outdated recommend just using the repl.it tutorial; much more clear.
On line 19 There is this message: Traceback (most recent call last): File "Path of where the project is stored", line 19, in if "responding" not in db.keys(): AttributeError: 'NoneType' object has no attribute 'keys'
bruh stop sleeping repl
Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "main.py", line 80, in on_message index = int(msg.split("$del", 1)[1]) IndexError: list index out of range I am getting this error whenever i type a command
stop sleeping
stop sleeping repl >:(
Line 59 it says this: File "main.py", line 59 await message.channel.send(random.choice(options))
SyntaxError: invalid syntax
The arrow is pointing at await
Its the same code as the video anyone know how to fix this?
if anyone had the issue "TypeError: can only concatenate list (not "str") to list", try adding list when assigning the db to variables like: awesome = list(db["awesomeness"]) options = options + list(db["awesomeness"])
Hi
Help me it showing await an outside function
depressed
lol
Die
So I do come to realize that I do not want random answers but predefined. so in both lists (I call them dictionary) I want to associate one word with other, so if person say for example "Honor", bot would answer "Honour". I seen this before in RedBot Cogs, but I do not like Redbot, and uses Javascript. How could I define this on Python?
Hi Guys, I have an error in my code that is like this:
Ignoring exception in on_message Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "main.py", line 60, in on_message options = options + db["encouragements"] TypeError: can only concatenate list (not "ObservedList") to list
I can fix this error by doing this options = options + list(db["encouragements"])
But what is "ObservedList"? The first time I ever met this error and I don't know what it is
full bugs
Hey I have fixed this code (September 11, 2021) you can view it in my profile or my github: https://github.com/96tahir/discordbot
if len(ez_message) > index I get invalid syntax
Okay
Where should I import TOKEN?
I think it's out of date.
this is a nice discord bot! i did it and i have a discord bot! thanks
nice
If anyone is getting errors with options = options + db["encouragements"]
Try replacing it with: options = options.extend(db["encouragements"])
And if that doesn't work try: options += db["encouragements"]
i have a problem running the command inspire as it gives me an error(ignoring exception in on_message & string indices must be integers), any help?
How do I create the .env?
File "main.py", line 63, in on_message await message.channel.send(random.choice(options)) File "/usr/lib/python3.8/random.py", line 288, in choice i = self._randbelow(len(seq)) TypeError: object of type 'NoneType' has no len()
anyone has this issue?
helppp i dont know how
thx for the tutorial
thank's for the tutorial
awesome tutorial
hi there i have an issue, i saw ur tutorial and here now .env in replit doesn't exist, now what should I do??
Hey
hi
how to run bot in python
nice bot
trash, doesnt even work. needed a real pro to help me out.
Hi
Great job with this tutorial!
For line 60, I had to replace options = options + db["encouragements"] with options = options.extend(db["encouragements"])
"WARNING: This is a development server. Do not use it in a production deployment." - Uptime Robot Will this be an issue, once our bot crosses 100+ servers and reaches the verification stage.
sad
Hey guys seen many people need help in many cases! join this server for help - https://discord.gg/xDvwKKrqv6
i am trying to work on making a bot and it says 'TOKEN' is not recognized does anybody know what to do?
Don't follow this guys youtube video he codes super wrong this is not how your supposed to do it
So when doing the get_quote function it doesn't seem to return the quote and instead a memory address e.g <function get_quote at 0x7fb4ff222550>
how do you make the.env file
Noice ome
ok
[SolverProblemError] Because replit (3.0.0) depends on flask (>=1.1.2,<2.0.0) and no versions of replit match >3.0.0,<4.0.0, replit (>=3.0.0,<4.0.0) requires flask (>=1.1.2,<2.0.0). So, because repl-python3-botibo2 depends on both replit (^3.0.0) and flask (^2.0.0), version solving failed. exit status 1 Repl.it: Package operation failed.
Hello guys, I have a problem like tihs. Could someone help me?
Ignoring exception in on_message Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "main.py", line 58, in on_message options = options + db["encouragements"] TypeError: can only concatenate list (not "ObservedList") to list
for some reason the lines
if message.content.startswith('!hi'): await message.channel.send('hi')
dont work for me, please help
whenever, I try to delete a encouraging messsage $del 0 the following ObservedList(value=[]) has been appearing in my server instead of showing what got deleted which should be something like this ['You are amazing.', 'You are so amazing and cool.'] . did any encounter this type of situation ? can you please help how to solve this ?
The quote part is not working anymore for some reason.. it doesn't return any error but it doesn't return a quote either when I type "$inspire"; I copied that part of the code from here to make sure and It still didn't work.
still confused with the data base part
Some reason on line 47 main.py it says i get a syntax error
Hi Beau! Thank you for the tutorial, it was super helpful and I learned a lot from your video! I have been trying to create my own version of the bot using the Evil Insult Generator, but I have no idea how to implement it here to this code. https://evilinsult.com/api/ any advise would really help!
When I type $list I see this: ObservedList(value=['You are amazing.', 'You are so amazing and cool.', 'You are the doing great, keep your head up!'])
instead of just: ['You are amazing.', 'You are so amazing and cool.', 'You are the doing great, keep your head up!']
any tips to help fix this?
Okay, those guys who cant get their tokens correct, first go left bar and click on lock icon [Secrets(Environment Variables)]. it will ask for token name and key. Paste the copied key in key section and give token name as TOKEN(you can choose any name here). after that it import os and add the following line client.run(os.environ['TOKEN']) It will work
File .env?
Not working ... :( I even copied/pasted the code to work out any human error (changing TOKEN to mine), but it ain't running no more.
Can you tell me how to replace .env files
File "main.py", line 81, in on_message options = options + db["encouragements"] UnboundLocalError: local variable 'options' referenced before assignment
Hello BeauCarnes! This Project is awesome Sir any ideas can you give so that I can develop this code more. May be some modifications .
Yours Sincerely, A Aaron Nicholas
can someone help please?
if message.author == client.user:
if message.author == client.user: ^
the "i" is not connecting with the rest of the code
How to fix this error? Do anyone have any idea? I need Urgent Help!
Ignoring exception in on_message Traceback (most recent call last): File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event await coro(*args, **kwargs) File "main.py", line 58, in on_message if db["responding"]: File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 434, in getitem raw_val = self.get_raw(key) File "/opt/virtualenvs/python3/lib/python3.8/site-packages/replit/database/database.py", line 474, in get_raw raise KeyError(key) KeyError: 'responding'
can o get some help,. my bot not replying when i say hello to him, im already trying to changing the word but its not working :(((
Really like your tutorial and code. Thank you so much to you and freecodecamp. (This is not a self ad. Because this is not my server. I have an error. after joining this server they solve it and by this server I started to make new customize bots. Join it if you have any problemo: https://discord.gg/V8HpbEuEtK )
I wanted a discord bot very much but this one didn't worked so many errors :(
I tried this and It doesn't work even once
help i keep on getting this error: Traceback (most recent call last): File "main.py", line 4, in Client = discord.client() TypeError: 'module' object is not callable
File "main.py", line 60, in on_message options = options + db["encouragements"] TypeError: can only concatenate list (not "ObservedList") to list
what happened?
hello, does anyone know how to make it mention the user and if so can you edit the script then reply the edited code link to me?
hi , how do i make a bot join a vc ? If someone could help me, that would be great!
Hey guys! Also another question, does any1 have an idea on how to make a rock paper scissors command?
there is also no error code
hi, how do i add a second command to a bot? i added one command, and it worked fine, I added another command, and that command does not work. If someone could help me, that would be awesome! ; D
Hello Can Someone Help Me At The Hello Code I Am Getting Syntax Error
Working so good
$hi
Why I can't see the HTTP tab when I run the program???
yes yes yes yes yes this is amazzzzzzzinnnnnnnnnnnnnngggggggggggggg
thank you.
Awesome tutorial, thank you so much!
Can anyone help me for the first part of the coding, everytime I try to run the bot it says a little orange thing
Where can I find the code for the starting project. The one where we import the discordy.py?
Thank you so much
@client.event is showing an eof error