When running bot sample code, I get this error

My code is exactly

This (With my token of course)

When I run it, my bot starts up as normal, but when a new person is added to the server, i get this.

------
Ignoring exception in on_member_join
Traceback (most recent call last):
  File "C:\Users\USRNAME\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "test.py", line 9, in on_member_join
    await client.send_message(server, fmt.format(member, server))
  File "C:\Users\USRNAME\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\client.py", line 1152, in send_message
    data = yield from self.http.send_message(channel_id, content, guild_id=guild_id, tts=tts, embed=embed)
  File "C:\Users\USRNAME\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\http.py", line 198, in request
    raise NotFound(r, data)
discord.errors.NotFound: NOT FOUND (status code: 404): Unknown Channel

(Sorry about it not being in a code block, I'm new to stack exchange)

Any help would be appreciated. Thanks

Upvotes: 1

Views: 1212

Answers (1)

ADug
ADug

Reputation: 314

This will not work anymore because discord removed default channels so sending it to server will not work. You should replace server with discord.Object('insert channel id') if you are using async or discord.Object(insert channel id) if you are using the rewrite branch. Note the string vs int difference. Good luck :)

Upvotes: 2

Related Questions