#im making a discord bot and it responds in dms but not in the server help
94 messages · Page 1 of 1 (latest)
make sure you have message contents intents enabled in the dev portal and your code
i do i think i need to fix something another person told me there was some stuff i had to change
and im not sure if im doing it right
want to see the code?
my token and bot owner id are in a file called configs
sure, go for it
could you be more specific on what they told you?
ill eplain after i send my code
@pliant notch
For safety reasons we do not allow files with certain file extensions.
You can share your code using triple backticks like this:
```
YOUR CODE
```
For longer scripts use Hastebin or GitHub Gists and share the link here
- message.txt
oh yeah you need to put in a github gist or hastebin
DO NOT use sqlite 3 DOnt use requests
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
alright
this is old code before i started to fix what they told me and completly broke my bot
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
DO NOT use requests DO NOT use sqlite3
i should be using aiohttp and aiosqlite / asqlite everything needs to be async
as for bs4 that should be run in asyncio.to_thread because theres nno async version
thats all i was told
originally it wouldnt talk in discord chats
now it doesnt talk at all
it would only respond in dms
yeah this is very true and needs to be fixed
can you send your current code?
just so i can get a better picture
i am
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
this is my first time using python and first time making a discord bot im confused
they told me to turn all requests to aiohttp aswell
you need to enable this in the discord developer portal aswell
thats fine, enable it in your code aswell
and try adding a print(message) in the top of the on_message event, just see if it shows anything
and is your on_ready running? printing 'We have logged in as ...'
just at the top of ur on_message
@client.event
async def on_message(message):
print(message)
if message.author == client.user:
return
... # rest of ur code
ok like that thank you
just need to see if its detecting anything
however you will need to change this, on_message should not be used for commands and its highly reccommended to use the discord.ext.commands extension
which should simplify your code a lot, it will just require a bit of effort to change
how is it as simple as going to on message and replacing it with this ```@bot.command()
async def test(ctx, arg):
await ctx.send(arg)
this is the basic concept yeah
heres an official example https://github.com/Rapptz/discord.py/blob/master/examples/basic_bot.py
so it doesnt say anything when i turn on the bot and when i run my commands the command pront says my code has issues on line 77 65 and 373
ok so imma try and do that and hope it works
it it telling you what the errors are?
what text editor are you coding in?
well
i run it off of a .py file on my computr and use comand promt to go to th edirectory and i run python bot.py and it starts my bot
im just using text doccuments
so like, notepad?
yup

because im not paying a company to run my bad bot i cant even get to work
you dont need to pay a company yet, just download a proper text editor to edit your code in
i think you are confused between the both
yes it works, but realistically it isnt made for coding. using something like visual studio code would be better as it has support for the programming languages via extensions and whatnot
ah
so download virtual studio code
then i import my code to that
and how do i turn it inot a .py file i can edit
you can just open your existing file
alright thank you
i think im gonna have a much easier time
it already asked to download they python extenssion
you 100% will
i think i did it and now its talking in discord but now my codes arnt working either
like commands
they hit in server chat with <coroutine object get_random_power at 0x0000014635F6F640>
i think i broke it
well they are both different libs, and do different things
aiohttp is for making requests, and bs4 is for parsing HTML
can you send ur updated code? so i can get a look at where you are now
yes im sorry had to do something
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
i dont know if its better or worse
none of my comcands work the only 2 that semi work are !random and !lookup and they bring out this as a response <coroutine object get_random_power at 0x0000019C30E6F760> and <coroutine object lookup_power at 0x0000019C30E813F0>
i joined discord.py discord because someone told me they could help and i didnt get help