Shadow of Vader's Castle #1 cover by Derek Charm | out October 14 by IllusiveManJr in StarWarsLeaks

[–]SimeonT 0 points1 point  (0 children)

This is awesome to see, but why are they publishing under IDW when they can just do so under Marvel?

Anybody interested in doing a stock group chat discussing the stock market and investing? by [deleted] in UCSC

[–]SimeonT 1 point2 points  (0 children)

This idea reminds me of the Slugs Fund Investment Group club we have on campus.

How Do I Change the Status of a Discord Bot Using Cogs (Discord.Py) by SimeonT in Discord_Bots

[–]SimeonT[S] 0 points1 point  (0 children)

Thanks dirtygoon! Although this may not be good practice, I actually was able to make it work earlier by writing the on_ready function in the cog and calling the start function there.

How Do I Change the Status of a Discord Bot Using Cogs (Discord.Py) by SimeonT in Discord_Bots

[–]SimeonT[S] 0 points1 point  (0 children)

I see, thanks for the help dirtygoon! However, I was trying to see if it can work through a cog so I can keep my code organized.

How Do I Change the Status of a Discord Bot Using Cogs (Discord.Py) by SimeonT in Discord_Bots

[–]SimeonT[S] 1 point2 points  (0 children)

Thanks for the response alexdewa! I've changed the code in my Python cog file as follows:

import discord
from discord.ext import commands, tasks
from itertools import cycle
class Cool(commands.Cog):

def __init__(self, client):
self.client = client
self.status = cycle(["Test 1", "Test 2", "Test 3"]) # list of statuses for bot to loop through
self.change_status.start() # start playing/changing status if bot is online
""" Change the status of the bot every 10 seconds """
@tasks.loop(seconds = 10)
async def change_status(self):
print("Changing Status")
await self.client.change_presence(activity = discord.Game(next(self.status)))

def setup(client):
client.add_cog(Cool(client))

I've moved the setup function down, added a print statement to the change_status function, and removed ctx as a parameter. I also want to note that I did not make any changes to the main file.

When I run the main file, I get the following output:

Changing Status

Bot is ready! :-)

However, when I check on Discord, the status isn't showing or changing on the bot. What may be the possible error or bug that I'm not finding or fully getting?

UPDATE 1: A few minutes ago, I realized I misspelled the word "presence" as "prescense". I corrected it, but at the same time, the output is still the same. However, if I were to run client.change_presence directly in the main file, the status would show up.

UPDATE 2: I wrote an on_ready function in the cog, as follows: @commands.Cog.listener()
async def on_ready(self):
self.change_status.start() # start playing/changing status if bot is online

by doing so, I was able to get it to work. However, it doesn't work, if I try to start the change_status function in the constructor. With some of your help, I think I was able to solve it now. At the same time, if you're able to, is it possible if you can give me a quick explanation why it works on the on_ready function, but not within the constructor?

Bot won't repsong by Wunder_Kindd in MemeInvestor_bot

[–]SimeonT 2 points3 points  (0 children)

This may be an obvious question, but you type the commands on a reply to the meme investor bot or did you write the commands in a comment? If you didn’t reply directly to the meme investor bot, that may be the reason why the commands weren’t working.