Discord.py: Troubles with bot status discord.py

Created on 14 Apr 2018  路  2Comments  路  Source: Rapptz/discord.py

This is my coding:

import discord
from discord.ext import commands
from discord.voice_client import VoiceClient
import asyncio
import time

client = discord.Client()

startup_extensions = ["Music"]
bot = commands.Bot("?")

@bot.event
async def on_ready():
print("bot started")

class Main_Commands():
def __init__(self, bot):
self.bot = bot

if __name__ == "__main__":
for extension in startup_extensions:
try:
bot.load_extension(extension)
except Exception as e:
exc = '{}: {}'.format(type(e).__name__, e)
print('Failed to load extension {}\n{}'.format(extension, exc))

@bot.event
async def on_ready():
await client.change_status(game=discord.Game(name='whatever'))

I want to change the status of my bot but how?? The last snippet is my attempt. Im new to python plz help...

invalid

All 2 comments

We strongly recommend becoming more familiar with python first. Some of the techniques here can be difficult for beginners.

Secondly dont mix commands.Bot and discord.Client use one or the other, commands.Bot can do everything discord.Client can in addition to a command framework.

Thirdly take a look at the examples, here is one to get you started https://github.com/Rapptz/discord.py/blob/async/examples/basic_bot.py

Finally questions like this are more suited to the discord.py discord server found here:
https://discord.gg/r3sSKJJ

@client.event
async def on_ready():
    await client.change_presence(game = discord.Game(
        name = 'game name'
    ))
Was this page helpful?
0 / 5 - 0 ratings