#im making a discord bot and it responds in dms but not in the server help

94 messages · Page 1 of 1 (latest)

pliant notch
#

i think its something with the code because it has administration its the first bot ive ever made

slow root
pliant notch
#

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

slow root
slow root
pliant notch
#

ill eplain after i send my code

rocky pantherBOT
#

@pliant notch

File Attachments Not Allowed

For safety reasons we do not allow files with certain file extensions.

Code Formatting

You can share your code using triple backticks like this:
```
YOUR CODE
```

Large Portions of Code

For longer scripts use Hastebin or GitHub Gists and share the link here

Ignored these files due to them having disallowed file extensions
  • message.txt
slow root
#

oh yeah you need to put in a github gist or hastebin

pliant notch
#

DO NOT use sqlite 3 DOnt use requests

slow root
pliant notch
#

theres more

#

let me do this real quick so you can read while i explain

slow root
#

alright

pliant notch
#

this is old code before i started to fix what they told me and completly broke my bot

slow root
#

oh yeah

#

and the new code?

pliant notch
#

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

slow root
#

can you send your current code?

#

just so i can get a better picture

pliant notch
#

i am

#

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

slow root
#

try enabling intents.message_content

#

and see if anything happens

pliant notch
#

it wont even respond in dms

#

but ill try

slow root
pliant notch
#

it is on

#

the only thing thats not is the presense one

#

or however you english

slow root
#

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 ...'

pliant notch
#

on the command prompt?

#

also put print(message) before on message right?

slow root
#

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

pliant notch
#

ok like that thank you

slow root
#

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

pliant notch
#

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)

pliant notch
#

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

slow root
#

what text editor are you coding in?

pliant notch
#

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

slow root
#

so like, notepad?

pliant notch
#

yup

slow root
pliant notch
#

because im not paying a company to run my bad bot i cant even get to work

slow root
#

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

pliant notch
#

?

#

i thought notpad worked

#

it works with java

#

atlest for me and minecraft mods

slow root
#

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

pliant notch
#

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

slow root
pliant notch
#

alright thank you

#

i think im gonna have a much easier time

#

it already asked to download they python extenssion

slow root
pliant notch
#

and a question

#

should i use bs4 and aiohhtps or just aiohhtps

pliant notch
#

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

slow root
#

aiohttp is for making requests, and bs4 is for parsing HTML

slow root
pliant notch
#

yes im sorry had to do something

pliant notch
#

i dont know if its better or worse

pliant notch
#

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>

pliant notch
#

i joined discord.py discord because someone told me they could help and i didnt get help