Update changelog.md
updated example to also work on previous python versions
@@ -9,10 +9,15 @@ for example:
def helloworld(resp):
if resp['t'] == "READY_SUPPLEMENTAL": #ready_supplemental is sent after ready
user = bot.gateway.SessionSettings.user
- print(f"Logged in as {user['username']}#{user['discriminator']}")
+ print("Logged in as {}#{}".format(user['username'], user['discriminator']))
if resp['t'] == "MESSAGE_CREATE":
m = resp['d']
- print(f"> guild {m['guild_id'] if 'guild_id' in m else None} channel {m['channel_id']} | {m['author']['username']}#{m['author']['discriminator']}: {m['content']}")
+ guildID = m['guild_id'] if 'guild_id' in m else None #because DMs are technically channels too
+ channelID = m['channel_id']
+ username = m['author']['username']
+ discriminator = m['author']['discriminator']
+ content = m['content']
+ print("> guild {} channel {} | {}#{}: {}".format(guildID, channelID, username, discriminator, content))
bot.gateway.run(auto_reconnect=True)
```
