How do I store a Discord channel as a global variable? #8105
Answered
by
rtk-rnjn
MasterOpel
asked this question in
General
-
In my Discord bot, I need to store the Discord channel of specific messages as a global variable. My bot is The Auto-Bumper Bot. |
Beta Was this translation helpful? Give feedback.
Answered by
rtk-rnjn
Jun 4, 2022
Replies: 1 comment
-
I don't know who suggested you to use You can define partial channel and store it in bot instance (it works same as channel) CHANNEL_ID = ...
GUILD_ID = ...
client = discord.Client(...)
client.channel = client.get_partial_messageable(CHANNEL_ID, guild_id=GUILD_ID) Example for from discord.ext import tasks
...
@tasks.loop(seconds=1800)
async def auto_bump():
await client.channel.send('/bump')
...
auto_bump.start()
client.run(token) It is also advice to make proper commands instead of parsing message content |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
MasterOpel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know who suggested you to use
Thread
.discord.py
has its own task system *shrug*You can define partial channel and store it in bot instance (it works same as channel)
Example for
ext.task
It is also advice to make proper commands instead of parsing message content