#discord-bots
1 messages · Page 412 of 1
Sorry I forgot to precise, right now I'm using discord.py
This isn't supported by discord.py yet
Alright, thanks for the answer.
guys my i am trying to create a new /command on my discord but its never appearing (a have created lots of / commands again before and this server already have 6 )
here is my code
import discord
from discord import app_commands, Interaction
from discord.ext import commands
from datetime import datetime, timedelta, timezone
from cogs.utils.database import (
increment_user_chips,
update_user_profile,
get_user_chips,
)
import asyncio
CLAIM_AMOUNT = 250
COOLDOWN_SECONDS = 3600 # 1 hour
async def get_last_claim(user_id: str):
from cogs.utils.database import db
def _get():
ref = db.collection("users").document(user_id)
doc = ref.get()
if doc.exists:
data = doc.to_dict()
return data.get("last_hourly_claim")
return None
return await asyncio.to_thread(_get)
async def set_last_claim(user_id: str, ts: float):
from cogs.utils.database import db
def _set():
ref = db.collection("users").document(user_id)
ref.set({"last_hourly_claim": ts}, merge=True)
await asyncio.to_thread(_set)
class Claim(commands.Cog):
def __init__(self, bot):
self.bot = bot
@app_commands.command(name="hourly", description="Claim free chips every hour!")
async def hourly(self, inter: Interaction):
await update_user_profile(
user_id=str(inter.user.id),
display_name=inter.user.display_name,
server_id=str(inter.guild.id),
server_name=inter.guild.name
)
user_id = str(inter.user.id)
now = datetime.now(timezone.utc).timestamp()
last_claim = await get_last_claim(user_id)
if last_claim is not None:
seconds_since = now - float(last_claim)
if seconds_since < COOLDOWN_SECONDS:
mins = int((COOLDOWN_SECONDS - seconds_since) // 60)
secs = int((COOLDOWN_SECONDS - seconds_since) % 60)
return await inter.response.send_message(
f"`⏳ You can claim again in {mins}m {secs}s.`", ephemeral=True
)
# Give chips!
await increment_user_chips(user_id, CLAIM_AMOUNT)
await set_last_claim(user_id, now)
amt = await get_user_chips(user_id)
await inter.response.send_message(
f"`✅ You claimed {CLAIM_AMOUNT} chips!`\nYour new balance: `{amt}` chips.",
ephemeral=True
)
async def setup(bot: commands.Bot):
await bot.add_cog(Claim(bot))
What library are you using?
in the main file you mean or what?
No, what discord library are you using
2.5.2
import discord
from discord.ext import commands
multiple libraries use that import
yes but the same way i created all my other slash command files worked
this is not working
I'm asking you which library you're using
they mean between discord.py and pycord and the others. i'm guessing discord.py, especially as its latest release is 2.5.2, while pycord appears to have went straight from 2.5.0 to 2.6.0
yeah most likely the case it's discord.py, helpful to verify though (or they could even have multiple libraries installed and don't know it)
even when i try to put the same command into an already existing file doesnt appear in /commands list
can you confirm you're using discord.py and only discord.py?
how do I delete the old slash command?
Youll need to prove more context
I have an old command and I want to delete it. It's not in the code, and there's no way to delete it on the discord application website either. What should I do in this case?
I've already tried to kick the bot and invite it (the command remains the same)
Restart discord and see if it still appears
Like fully close task manager it
It's not even online, but it still displays the command.
- it didn't help to kick the bot and invite someone else.
- deleting the code and restarting didn't help either
Did you take manager discord and reopen
You can try resetting the bot token
resetting the token will not help to remove the slash command. I tried anyway, though.
What library are you using?
again we dont know what library just with that namespace

It should be removed when you sync the commands
A token reset removing all your app commands would be so annoying lmfao
Thank you all for your advice. But not one method worked except for the complete removal of the bot itself in discord aplication.
I understand that after deleting the lines in visual studio code and restarting, the slash command should have disappeared, but it didn't disappear for me.
❤️
Do you know what library you're using yet
try unloading cogs and commands
and restart your discord
That does quite literally nothing in some contexts and libraries. We need to know what library they're using or y'all are going to just keep making random guesses
Ive never used python before, anythiing i should know before i use a script
A discord bot script? Or a script in general? Also what script?
just a script
idk what script yet
Would i be messed up for scamming back what my friend got scammed for?
Well this is the discord bots channel...
contact trust and safety team of whatever platform it happened on
its roblox they dont care
im just trying to get back what was scammed nothing else
we won't help with that then
i wanna ask somethign actuallydo u know how to automatically messages in dm
i tried in this video but the delte icon is not appearing : https://www.youtube.com/watch?v=tVDt30HrlSk
How to Delete All Messages on Discord DMs & Channels
Learn how to Delete all messages on discord dms or channels (server)
If this video has helped you out, please like the video and leave a comment down below. Thanks!
Subscribe for a cookie! :D
#GeckoGuide #Discord #DeleteAllMessages #DM
Yeah it's against tos to do any automation behind user accounts
this isn't a bot anyways so not in the purview of this channel
I misunderstood the scope of the question. Pardon my morning brain.
Maybe if you are in EU, you could probably use GDPR to force ask Discord to delete them?
You don't need to be in EU for that
Or just don't send things on discord that you don't want to be on discord
That's not a solution, it's a precaution
Regardless its outside the scope of this channel
Hi can someone help with some code that me and a mate are working on please
we keep coming into errors... lmk if you can help and I'll see if I can send the code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
https://paste.pythondiscord.com/TLZQ
the errors seem to be based on the outputs that we receive...
the purpose of the bot is to do a "interview" (setup process) for new players to the server
the command should be run by an interviewer on behalf of an interviewee. it should later get the interviewee to enter some bits of data
both should be outputted into specific channels
Any thoughts @quick gust?
You'll have to explain what's not working
atm the interviewee doesn't recieve the dm to answer their part
You should avoid dming people if not needed, especially for things they themselves didn't initiate
well these are the 2 channels that the bot pastes stuff in... We need the bot to get the players to answer some questions directly from the bot, because it makes it easier to get their appropriate gamertag
They can submit things to the bot without the bot dming them unprompted
how would you do this?
You're already using modals, they could fill out a modal
I mean make life easier for yourself and ask for their consent either through the bot or manually (maybe when they sign up for the interview, or however your system works) before trying to DM them
well it is a verbal "interview" in a vc... I get that it makes sense to ask permission to get the bot to dm them
Well surely they sign up for an interview somewhere right?
Yeah we ask them to enter a specific vc and to ping the interviewer role when they are ready... as soon as staff on the server can get to them, then we start
What is the DM actually serving? To gather information or just to notify them
the dm is to get their gamertag and platform, since it can sometimes be difficult to spell and hence easier for them to grab and copy paste
yeah I'd recommend having them input that in a command rather than cold dming them
Oh so you don't even need to DM them then, just tell em to run a command or something while you're interviewing them
so ask them to type something /gamertag and get them to fill it out there?
the thing is, the result of the whole interview needs to be stored in a channel for security reasons
because it's for a milsim group where server nuking, dual simming (really bad where people play in multiple milsims) and spying frequently happens
I guess it could work
It'll stay private if you keep the interaction ephemeral and store it securely
we aren't but it is something that happens in the community
okay and this gamertag command can be linked to the interview result?
Sure, just use a database to make it easier
well the server currently uses sheets and the plan is to get this whole process integrated to the sheets document
If you haven't already dipped your toes in that topic, you should; it'll genuinely make it so much easier to handle large sums of data
Why not do both?
wdym?
go on? any suggestions?
Yeah start with sqlite/aiosqlite, its simple and works well for small scale operations
Make sure you understand SQL though
how many players can it handle?
I understand a bit of SQL
and the guy doing the coding works in the coding industry... (I'd hope he does too then)
SQLite can definitely "handle" more players than you'll ever have to store
You don't have to worry about that
mind if I ask what it's limitations are?
Well you'd get a better answer in #databases but the only limitation that I know of is that it is file-based (.db files) without any proper authentication system
If someone gets access to the .db file that stores the data there's nothing stopping them from accessing any of the data inside
I'm guessing the prevention method is to only give access to trusted staff and the owner
You shouldn't be giving anyone the raw .db files
Make a system to display the data fetched from it
Maybe make a loop that runs every x minutes, gets the data from the database and dumps it in a spreadsheet
Yeah makes sense
Damn now I need to get this implemented and will probs have to spend a few hours explaining to the server owner how it works
It's worth it though
Relying on discord channels to store data is extremely bad
Sure, it makes it easy for humans to read but difficult for a program to manage. With a little more effort, you'll be increasing your knowledge and can also develop something which will make the data easier to work with
Thanks I appreciate it
@unreal monolith is my code guy and has done a great job based on what he's been given so far @quick gust
that's great
Yeah he's reading through this discussion rn btw
This is not true if it's encrypted, which it absolutely should be per the developer TOS
but catching up absolutely do not use discord messages in lieu of a database if you need to store and access things programmatically
I see 
Thanks I appreciate the knowledge
my discord commands are dublicated to my main server bot not to other test servers
What library are you using?
discord 2.5.2
Discord isn't a library
How are you syncing your commands?
async def setup_hook(self):
main_guild = discord.Object(id=MAIN_GUILD_ID)
self.tree.clear_commands(guild=main_guild)
await self.tree.sync(guild=main_guild)
print("✅ Pruned all main-server-only commands.")
async def on_ready(self):
print(f"🔌 Logged in as {self.user} (ID: {self.user.id})")
i have a cog for main server
and one cog for global servers
You should not be syncing every time your bot starts
so?
You sync when you want discord to know that the commands have changed that they need to know
Duplicates happen when you sync the same command both globally and to a guild
ok and how can i make it synce to keep some commands to my main server and some to global ?
Technically it is, just you shouldn't use it and should replace it to discord.py instead (e.g. it is 2 minor versions outdated now)
Declare the commands as you want them in code and then sync both globally and to that guild
technically discord is a pypi package which mirrors the discord.py library
If discord is a package, then discord.py is also a package
it is also a library
Abstractly, a set of code maintained by one or more maintainers (usually housed in a single repository)
libraries are not necessarily 1:1 with packages
what i should change to this code finally?😂
^
so it will keep some commands to my main server only(i have some admin commands)
and all the global commands to all server (not dublicated)?
Commands are either global or tied to a guild
so i cant keep some commands for a server and all the others for another main admin server?
ok but i cant understand why other commands getting dublicated to the main server
thats what i want to solve and i dont know how
its annoying
because at some point you synced it to both scopes
do what I said and it will get fixed
can you please send me what to change
in the code i send before
I'm not going to write code for you. If you don't understand what I recommended, you can ask questions
ok
so
self.tree.clear_commands(guild=main_guild)
i use this and after maybe comment it?
no
I said to declare the commands in the end state you want them in
and then to sync twice. Once globally, and once on the guild
ok so i have to first declare both as globally and then seperate it?
await self.auto_discover_and_load_cogs("cogs")
await self.auto_discover_and_load_cogs("MainServer")
#self.tree.clear_commands(guild=main_guild) # (no await)
#await self.tree.sync(guild=main_guild)
like this?
do you want the commands to be global? like available in all servers
some commands to all servers and some only to the main one
Then declare them as such, reload your code, and then sync on both contexts
I don’t know how to do it that’s why I asked you correct , I know that this is not the concept of this server but I am really confused with this
Please
which part?
In the main file that you said u have to declare and then sync
.
so this I told you to do three things. Which of them do you not know how to do
Isn’t it already declared ?
async def cog_load(self):
try:
self.bot.tree.copy_global_to(guild=discord.Object(id=MAIN_GUILD_ID))
except Exception:
pass
await self.bot.tree.sync(guild=discord.Object(id=MAIN_GUILD_ID))
@app_commands.command(name="removelog", description="Remove a logs channel assignment from a game (main server only).")
@app_commands.guilds(discord.Object(id=MAIN_GUILD_ID))
this is my declaration for the file that i want to be only in the main server
and here is a declaration for a file that the command is dublicated in my main server
@app_commands.command(name="coinflip", description="Flip a coin anywhere.")
async def test1(self, interaction: discord.Interaction, ...)
Why are you using copy_global_to
That copies ALL commands to that guild internally
just sync per that guild and globally
And don't sync inside a cog or automatic at all
This is the solution to my problem ?
most likely
async def setup_hook(self):
main_guild = discord.Object(id=MAIN_GUILD_ID)
await self.auto_discover_and_load_cogs("cogs")
await self.auto_discover_and_load_cogs("MainServer")
await self.tree.sync()
print("✅ Synced global commands!")
await self.tree.sync(guild=main_guild)
print("✅ Synced main-server-only commands!")
async def on_ready(self):
print(f"🔌 Logged in as {self.user} (ID: {self.user.id})")
still dublicated commands
did you remove the copy_global_to and clear the dups
yes
try the following:
# RUN THIS ONCE
self.tree.clear_commands(guild=main_guild)
self.tree.clear_commands(guild=None)
await self.tree.sync(guild=main_guild)
await self.tree.sync()
# RUN THIS ONCE
- remove current syncs and add above code
- restart bot
- remove above code and add back previous syncs
- restart bot
@app_commands.command(name="coinflip", description="Flip a coin")
async def coinflip(self, interaction: discord.Interaction): #for the global commands
@app_commands.command(name="addlog", description="Assign log channel")
@app_commands.guilds(discord.Object(id=MAIN_GUILD_ID))
async def addlog(self, interaction: discord.Interaction, ...): #for the main server
is that right?
yup
ok this is what i do
^
- so i delete this for now
- i run what you send
- restart
- i put the following code again
- restart again
async def setup_hook(self):
main_guild = discord.Object(id=MAIN_GUILD_ID)
await self.auto_discover_and_load_cogs("cogs")
await self.auto_discover_and_load_cogs("MainServer")
await self.tree.sync()
print("✅ Synced global commands!")
await self.tree.sync(guild=main_guild)
print("✅ Synced main-server-only commands!")
async def on_ready(self):
print(f"🔌 Logged in as {self.user} (ID: {self.user.id})")
yes.
lets see
i runned like this
async def setup_hook(self):
main_guild = discord.Object(id=MAIN_GUILD_ID)
self.tree.clear_commands(guild=main_guild)
self.tree.clear_commands(guild=None)
await self.tree.sync(guild=main_guild)
await self.tree.sync()
# Second: sync main-server-only commands to your main guild
await self.tree.sync(guild=main_guild)
print("✅ Synced main-server-only commands!")
async def on_ready(self):
print(f"🔌 Logged in as {self.user} (ID: {self.user.id})"
``` is that right?
why are you clearing commands
and is this after you've loaded all commands into the tree?
remove the last sync too
well it doesn't matter now
you synced twice to one guild
when i run this there is no command into the servers
nice
i dont have to clean commands then?
no
Do this, and only this, noting you need to sync after you've added all of your commands to the tree. This is why I told you not to do it in setup_hook but you're still doing it
do you still have that copy_global_to...
i am coocked
no i will send you the file
can you please send me the solution
i am stuck for 6-7 hours in this ptoblem
following those steps should've fixed it all.. idk what you're doing imfao
wrong message
can you come with me to the voic one to share you my screen?
that
no
read your code
remove any copy_global_to, clear_commands, sync from your code and start fresh
not working..
what did you do
1 i have no copy_global_to
i cleared the commands with the code you send
after that i synced with the old code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
and the cogs?
i will send only one as an example
you want the global cog or the one i want to the main server only
https://paste.pythondiscord.com/5FDQ (global cog)
both
and stop using clear_commands
https://paste.pythondiscord.com/H2DA (the main server commands only)
now i can see no commands to my server
async def setup_hook(self):
main_guild = discord.Object(id=MAIN_GUILD_ID)
# Load global commands (cogs/) and main-server-only commands (MainServer/)
await self.auto_discover_and_load_cogs("cogs")
await self.auto_discover_and_load_cogs("MainServer")
#Uncomment and run ONCE if you see duplicates, then comment/remove!
await self.tree.sync(guild=main_guild)
# 1. Sync global commands globally
await self.tree.sync()
print("✅ Synced all global commands!")
# 2. Sync guild-only commands to your main guild
await self.tree.sync(guild=main_guild)
print("✅ Synced main-server-only commands!")
if i try this?
What you building
so i keep only this
await self.auto_discover_and_load_cogs("cogs")
await self.auto_discover_and_load_cogs("MainServer")
in setup_hook yes
ok now commandsa re not dublicated but i dont have me mainserver commands only
now you should write a prefix command that syncs them and whatever you want
...
bot = MyBot()
@bot.command()
@commands.is_owner()
async def sync(ctx: commands.Context):
...
if __name__ == "__main__":
bot.run(TOKEN)
bot = MyBot()
@bot.command()
@commands.is_owner()
async def sync(ctx: commands.Context):
"""Syncs slash commands globally and for main server only. (Bot owner only)"""
try:
await bot.tree.sync()
main_guild = discord.Object(id=MAIN_GUILD_ID)
await bot.tree.sync(guild=main_guild)
await ctx.send("✅ Slash commands synced globally and to the main server!")
except Exception as e:
await ctx.send(f"❌ Sync failed: `{type(e).__name__}: {e}`")
if __name__ == "__main__":
bot.run(TOKEN)
is this okay
not sure why everything is wrapped into try-excepy but sure
omg this finally worked
async def setup_hook(self):
await self.auto_discover_and_load_cogs("cogs")
await self.auto_discover_and_load_cogs("MainServer")
async def on_ready(self):
print(f"🔌 Logged in as {self.user} (ID: {self.user.id})")
if not self.synced:
await self.tree.sync()
main_guild = discord.Object(id=MAIN_GUILD_ID)
await self.tree.sync(guild=main_guild)
print("✅ Synced slash commands globally and for main server!")
self.synced = True
async def auto_discover_and_load_cogs(self, cog_folder):
for root, dirs, files in os.walk(cog_folder):
for file in files:
if file.endswith(".py") and file != "__init__.py":
ext = os.path.splitext(os.path.relpath(os.path.join(root, file), "."))[0]
ext = ext.replace(os.path.sep, ".")
try:
await self.load_extension(ext)
print(f"✅ Loaded {ext}")
except Exception as e:
print(f"❌ Failed to load {ext}: {e}")
if __name__ == "__main__":
bot = MyBot()
bot.run(TOKEN)
dont' sync in on_ready
...........................................................
man we tell you these things like 5 times and you completely ignore them
that's the dumbest thing you've could've done.
really?
but its working
is this better?
bot = MyBot()
@bot.command()
@commands.is_owner()
async def sync(ctx: commands.Context):
"""Syncs slash commands globally and for main server only. (Bot owner only)"""
try:
await bot.tree.sync()
main_guild = discord.Object(id=MAIN_GUILD_ID)
await bot.tree.sync(guild=main_guild)
await ctx.send("✅ Slash commands synced globally and to the main server!")
except Exception as e:
await ctx.send(f"❌ Sync failed: `{type(e).__name__}: {e}`")
if __name__ == "__main__":
bot.run(TOKEN)
i just want to sync automatically without !sync
why?
you only need to sync when you change something
it has a high ratelimit, which means your bot can get temp banned if you call it way too often
so if i want to add another command only for main server i have to use the !sync?
yes
that' will also sync globally, which is not the best thing to do but you can figure that out
so what else can i do to avoid globally sync and only guild sync
maybe add a parameter that can switch between the two
like !syncmain
! sync global?
and what is this?
click it
yes but i only have 2 options main and global i dont need more that he want to say i think
@bot.command()
@commands.is_owner()
async def syncglobal(ctx: commands.Context):
"""Syncs slash commands globally (owner only)."""
try:
await bot.tree.sync()
await ctx.send("✅ Slash commands synced globally!")
except Exception as e:
await ctx.send(f"❌ Global sync failed: `{type(e).__name__}: {e}`")
@bot.command()
@commands.is_owner()
async def syncmain(ctx: commands.Context):
"""Syncs slash commands only for your main server (owner only)."""
try:
await bot.tree.sync(guild=discord.Object(id=MAIN_GUILD_ID))
await ctx.send("✅ Slash commands synced for the main server!")
except Exception as e:
await ctx.send(f"❌ Main server sync failed: `{type(e).__name__}: {e}`")
if __name__ == "__main__":
bot.run(TOKEN)
is it good now>
lgtm
@bot.command()
@commands.is_owner()
async def sync(ctx: commands.Context, where: str = "global"):
"""
Syncs slash commands.
Usage:
!sync global - Syncs globally (default)
!sync main - Syncs to the main server only
"""
try:
if where.lower() == "main":
await bot.tree.sync(guild=discord.Object(id=MAIN_GUILD_ID))
await ctx.send("✅ Synced slash commands to the main server only!")
else:
await bot.tree.sync()
await ctx.send("✅ Synced slash commands globally!")
except Exception as e:
await ctx.send(f"❌ Sync failed: `{type(e).__name__}: {e}`")
better?
perfect!
could add a "both" option too
sync returns the commands too so you could maybe output that amount
like !syncall
i meant more like elif where.lower() == "both": ...
i cant get my commands to sync to my server ive tried to global and guild sync
async def setup_hook(self):
print("Setting up bot...")
for filename in os.listdir('./cogs'):
if filename.endswith('.py'):
await self.load_extension(f'cogs.{filename[:-3]}')
# try:
# global_synced = await self.tree.sync()
# print(f"Globally synced {len(global_synced)} commands")
try:
synced = await self.tree.sync(guild=discord.Object(id=GUILD_ID))
print(f"Synced {len(synced)} command(s) to guild {GUILD_ID}")
except Exception as e:
print(f"Failed to sync commands to guild {GUILD_ID}: {e}")
print("Available commands:", [cmd.name for cmd in self.tree.get_commands(guild=discord.Object(id=GUILD_ID))])
import discord
from discord.ext import commands
class Ping(commands.Cog):
def __init__(self, bot):
self.bot = bot
@discord.app_commands.command(name="ping", description="Check if the bot is alive")
async def ping(self, interaction: discord.Interaction):
await interaction.response.send_message("Pong!")
async def setup(bot):
await bot.add_cog(Ping(bot))
Try global + restarting your app (ctrl r)
ive tried global, closing the app and relaunching the script as issue
when i do global, it says globally synced x commands, but in my server nothing is available waited a while also
nvm, just realised what you mean by restart app.. discord not code
yep working now, miss understood lol
Hi guys, Im beginner in python and im quite interested in discord bots atm, any ideas on what project i should make? my most advanced project is a simple turn based game and a blackjack game
is that implemented as a discord bot or a terminal program?
as a discord bot, i did host it on my pc but it worked in discord
oh cool
have you tried to make an economy system yet? I think it's a good way to learn good database usage and organising mulile functions- > working, shopping, interacting with other users, etc.
Seems like they are switching from js
ill try, thanks!
running into an issue where BeeBot won't read forums and respond automatically, It used to but then i switched to slash commands and that broke it
Is this your code?
yes
As a heads up, it looks like this sends messages to a third party (openAI) without gathering and recording user consent to do so, which violates TOS
Slash commands alone wouldn't change your underlying logic
It's good to give the TOS a read before handling any user data. For the functional bits, it would be helpful to do some preliminary debugging and identify the part of code that isn't behaving like you expect
ok!
making a consent checker first rq as that is the bigger issue, but i'll get back to you after debugging
appreciate it, and double check your OpenAI settings that you're not having them train on your inputs
I think that defaults off now but I've had people leave it on mistakenly which runs afoul of the dev policy
yeah its off 😄
If open AI is not considered a service provider, which in this case it could be. Still better to be safe then sorry
I am going to think it's safe to assume they have not written a personal letter to a solo developer making promises
And they do not make such promises anywhere in their terms (exhaustively, that I could find at least)
Click here to see this code in our pastebin.
Which part is failing? Do you have any debugging in?
like knowing if your on_message is firing at all
yeah on message is running, it the on thread create that isn't working
Every other channel works, just not forums
So on_thread_create doesnt fire at all? Or it's not running through properly?
And as an aside, on_ready fires repeatedly and randomly, I strongly suggest not putting anything in there besides local logging
🧵 Thread created: hello (ID: 1393620455692439762) in Cluster Bee Hive
🔕 Thread parent is not a forum: general-buzz-🐝
🧵 Thread created: beebot (ID) in Cluster Bee Hive
🔍 Checking if auto-reply is enabled for forum: vents-💌 (ID: 1389797690417610865)
✅ Joined thread
📥 Collecting thread messages...
📝 Conversation collected:
TrinketGoblinCh: hello
🐛 Error in thread handler: 'async_generator' object has no attribute 'flatten'
Yeah flatten isn't a thing any more
ohhhhhhhh
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator) that enables receiving the destination’s message history.
You must have [`read_message_history`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.read_message_history) to do this.
Examples...
Do you have copy rights to that music?
is there a method to align my text in embed (i am using custom emojis)
how can i fix it?
do you have a license to use the music (either specifically granted by the creator or the creator license to general public)
if so, what is the license?
well then yes it's against discord tos unless you have copy rights or it's royalty free music
You need to check yourself, I am not a lawyer and not your lawyer
!pypi prettytable
Note this would require you to put the whole thing in code lock with no formatting
The other option, use inline fields
or do you have another suggestion?
generate an image and send it
🥴
I don't have better idea
But also it won't work for the spoiler that demonstrates from the examples
And using image is a weird way to solve a problem (Note that I didn't say bad)
There isn't a way to preserve the interactiveness and keep this in format easily
You might able to calculate the font width for each character to calculate how many space but how don't know how well that would work or if anyone have implemented it before (and clearly not a better solution)
Basically try not to have tabular data in discord
Is there a reason that you even need the line X part?
you can use padding
You need to guess the padding since discord doesn't use monospace
Which described here: #discord-bots message
Like:
HHHH
iiii
Look at the length difference
well well
there is another option to use unicode spaces, but again youll have to guess the width
Hello, I'm having trouble creating an allowlist system for my FiveM server. Does anyone have any guidance or tutorials on how to do this? I'm new to this.
What is this allowlist about? And what does it do
It's for a fivem server, the player answers a series of questions and then their answers are sent to a channel where the team can approve or disapprove, if disapproved, they send the reason for the disapproval to a disapproved channel, and if approved, they send it to the approved channel
The problem is with the buttons I want to use (send the allowlist, redo, or cancel) and also with saving the buttons' functionality if the bot restarts. For example: I needed to restart the bot, and a user was creating the allowlist, and everything stopped and didn't return to where it was.
you need to make the buttons persistent. assuming you're using one of the common libraries like discord.py, they'll have documentation how you can do it specifically, but basically whenever you send a message with a view you'll want to store that data in a database along with the message ID the view is attached to, then on startup you can restore everything
i have a file that is counting my /commands usage in my server
and i am trying to caregorize these commands eg "admin commands or gaming commands etc"
but this file always counting all /commands as "other" and not to the right category
that depends on your internal logic without it we cant say anythin
class Statistics(commands.Cog):
...
def __init__(self, bot: commands.Bot):
self.bot = bot
self.bg_task = bot.loop.create_task(self.midnight_reset_loop())
self.update_lock = asyncio.Lock()
self.pending_update = False
self.update_task = bot.loop.create_task(self._stats_update_loop())
# Dynamically generated
self.category_names = {} # {cat: label}
self.command_to_category = {} # {cmd_name: cat}
# Build these on startup
bot.loop.create_task(self._build_dynamic_category_maps())
async def _build_dynamic_category_maps(self):
await self.bot.wait_until_ready()
for cog_name, cog in self.bot.cogs.items():
cat = getattr(cog, "category", None) or "utils"
# Make it look nice
label = cat.capitalize() if cat else cog_name.capitalize()
self.category_names[cat] = label
for cmd in self.bot.commands:
cat = getattr(cmd.cog, "category", None) if cmd.cog else "utils"
self.command_to_category[cmd.name] = cat
if hasattr(self.bot, "tree"):
for appcmd in self.bot.tree.get_commands():
cat = getattr(appcmd, "cog", None)
if cat:
cat = getattr(cat, "category", None) or "utils"
else:
cat = "utils"
self.command_to_category[appcmd.name] = cat
and i put after each cogs class this category = "economy"
are you using slash commands
i think you could use appcommands.extras to store the category for each command
how it works?
this file its updating an embed every 15 sec
so if the command is in category games it makes the embed +1
well its something like
@app_commands.command(name="ping", description="check ping")
async def ping(interaction: discord.Interaction):
#stuff here
ping.extras = {"category": "utility"}
then u can do something like
for cmd in self.bot.tree.get_commands():
cat = cmd.extras.get("category", "default something")
self.command_to_category[cmd.name] = cat
here is the full code if its helping you https://paste.pythondiscord.com/5RBQ
you can try this, its very simple, you just have to add one line per command and dont have to worry about dealing with cogs
i have to add one line to each cog? like i did before right?
not each cog, each command
each cog is 1 command
okay then that works too just remember to add extras to the command that you define, i think the problem u were facing was due to the way slash commands are bound to cogs
gg
So why in discord, when you click "Add App" you can see how many guilds the bot is in. Now we do have Approximate Guild Count
Why when adding the app the guild count is updated and not updated via that. Idk the actual discord api endpoint, but someone will.
Basically what im asking is, why Approximate Guild Count via dpy not the same for discord? Then inside of the developer portal its behind. So based on Approximate Count its behind via discord add app, but ahead of discord dev portal
Just wondering WHY each 3 counters aren't synced is WHAT im getting at
Hopefully someone understands my stupid question
I don't think they count the same things.
Here is an example ^
Rn dev portal is synced but thats just an example
And i have no clue how often approximate guild count is updated on discords api.
Explain pls? I am a little slow rn
Description See the thread in discord's dev support server. Else, read below: https://discord.com/channels/613425648685547541/1318784803289563166 I noticed that my bot has a strange discrepancy...
Okay, still a little confused as I dont allow user install?
I read some of it
From what I read its a cache issue
Yes,
It seems one value is updated once every 24 hours at about the same time, and then the other value is calculated when you call the endpoint but then cached for 24 hours.
Ah, okay that makes sense now..
@stark ingot sorry for ping, but then why are all 3 values different sometimes? Are they all cached differently?
It is not guaranteed that all your installs have the bot scope, I think
Hm weird
That is very weird
Goofy discord stuff lmao
Well, ty for telling me the issue, I didn't know if it was discord or how I was doing things 😅
Yeah, I would just pick one to base your stats on.
Yeah.
have discord removed the ability to remove slash commands? from app directly
"removing slash commands" means sending an empty payload to the endpoint
disallowing that would break a lot of people's code for no valid reason. So I doubt it.
what's happening?
I would appreciate some eyes on https://discord.com/channels/267624335836053506/1394428552358658270
Would someone be willing to vc with me and help me with my discord bot? i am a complete beginner to discord bots and i just wanted to try and make a command that you can input a channel id and then it will turn that channel into a simple counting channel...
Hey I have a question, so in discord you do have Rich Presence, is there a way for a DISCORD bot to put Rich Presence on a person's activity?
Idk if its possible but curious
just send your code here i can help you
i think so but that may be against tos
how can i configure logging with bot.start()? i want to pass my log handler i am using discord.py
!hosting
Using free hosting options like repl.it for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.
See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.
You may also use #965291480992321536 to discuss different discord bot hosting options.
!d discord.utils.setup_logging
discord.utils.setup_logging(*, handler=..., formatter=..., level=..., root=True)```
A helper function to setup logging.
This is superficially similar to [`logging.basicConfig()`](https://docs.python.org/3/library/logging.html#logging.basicConfig) but uses different defaults and a colour formatter if the stream can display colour.
This is used by the [`Client`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Client) to set up logging if `log_handler` is not `None`...
@mild token ^
no
Unless you install a software on the client device, no
!hosting
Using free hosting options like repl.it for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.
See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.
You may also use #965291480992321536 to discuss different discord bot hosting options.
!hosting
i would put it in a rich embed and use fields
the other way is discord number formatting and putting things that will break the formatting on a new line
i mean its cool
but practically useless unless you have some specific need for them
Why is it useful?
Why not just run them separately why even use threads
me when im too lazy to write 2 commands
Thanks, my brain has just short-circuited
music bot shouldn't have permission to delete message however
Pretty sure what you're describing is literally rate limit evasion
That's not a good thing
Should probably stop doing that before discord terminates your bots and/or your account
Or maybe don't openly talk about violating the developer policy and by extension this server's rules
You are circumventing the rate limit placed on your bot by farming our operations to other bots. That's directly against policy
As described in the Developer Terms, Discord may set and enforce limits on your use of the APIs (e.g., by limiting the number of API requests that you may make, or the number of users you may serve) at our sole discretion. You agree to, and will not attempt to circumvent, such limitations we set for each API.
If you would like to use any API beyond these limits, you must obtain Discord’s express written consent. Discord may, at our discretion, decline such request or condition acceptance on your agreement to additional terms and/or charges for such use.
Hey guys I’m new to python, but I have programming experience. I want to start my journey with discord bots, the discord.py docs aren’t as simplified as discord.js .
Any helpful reading materials concerning discord bots that’d are just as clear as discord.js
which part are you confused on in the d.py docs?
Have you found the discord.py masterclass yet? I can't personally vouch for it, but it's recommended in our resources.
Slash commands for a start. I can already use commands by prefix
Not yet, it’s a course?
Not in the classical sense; it's an extensive, written tutorial.
See e.g. the part on slash commands
Thanks will check it out
Seems like it focuses more on examples and explanation than specifics which is very nice
I prefer content like that
That's good then ig, but you should still pair it with the docs since a lot of the specifics are missing
-# Can't say much either since I have not actually read it
Yes, of course
FWIW this guide is not endorsed by the library maintainers. Use at your own discretion, I personally have qualms with things in it
It's all open source for PRs and such
Or ping the maintainer 
What would be the best way to store data that is never changed, but the user should be able to access. Probably in the ballpark of 5-10k ints and strings. Using a database/JSON/dictionaries all work but im not really sure what the trade offs are for each, or if theres a better way
JSON files aren't databases and not suitable for storing shifting data for a live application. They're also just horribly inefficient for everything besides transit between applications
Even csv files would be better
There's really no downside to using something lightweight like a sqlite db. But depending on the nature of this data you might be able to get better compression on other formats, though at the scale of 10k that really doesn't matter
store data that is never changed
...
Yes, I read that. 80% of the time when people say something will never change it does
Which is why I followed that up with caveats
ah i should have said im using mongodb as my database. implementing a new db purely for data seems like a bad idea. its mostly item data, so damage and other stats that the user should be able to look up. so mostly "item_name"{"data": "data"...}. I would want this data to be accessed quite often
it could in theory change, but i would never want the user to be able to change it
You could have locked down entry points in your app that allow you to change it
You also don't need a whole new database. This could just be a new table/collection. though it's generally unlikely that your data is actually nonrelational
ive only used SQL a little bit, but its quite different from Mongo. I wouldnt know how to use SQL without making an entirely new db 😅
or SQL lite, ig ive never used pure SQL
People often fall into the trap of using mongo because it's "easy" and then later deeply regret it
but all my data that i intend to have be changed is handled already by mongo
😭
yea i kinda did too, but I have learnt how to use it now
If your data is relational, you almost certainly will get into an easily avoidable problem.
That aside, regardless of what db you use there's really no reason I can see not to just use that db for what you're describing
ok thank you, I just wasnt sure if that was the right choice since i do intend to use the data quite a bit
You can cache it in memory still
but mongo has been fine for me, everything i wanted to do with changing data i have solved, i think
Everything it works until it doesn't
I would recommend learning what relational and non relational data are, and then reading at least one of the many articles bemoaning how mongo screwed them over
yea which is somewhat why i was thinking about just caching the whole thing
through a dictionary 😅
That's not a database just because you call it that. Nobody is setting rules here
Lazy as hell ragebait
Lmaooo
Is that the same person that did the on_ready syncing ragebait before
Too much time on your hands
no its not
Why is it always this one person doing the most stupid shit
Are you asking for help or just starting shit
none of your code even has a slash command
Also the multiple bot in same python process
What is difference between discord.UserFlags.spammer and discord.PublicUserFlags.spammer?
They’re not the same class as far as I know
Apparently stating fact is not allowed
?
I don’t think doing that is allowed tbh
Worth pinging a mod or admin :3
<@&831776746206265384> this person is being rude to random persons with no apparent reason
also sent a something and deleted it lol
im like 200% sure they have message logs

I don’t, the one who should care is you tbh
Anyways, I’m off , good luck
!timeout 1346773577575301152 1h investigating
!mute 1346773577575301152 1h investigating
:incoming_envelope: :ok_hand: applied timeout to @slate swan until <t:1752791759:f> (59 minutes and 58 seconds).
:x: According to my records, this user already has a timeout infraction. See infraction #104272.
Thanks, and sorry for pinging
!tempban 1346773577575301152 14D The messages you sent and being rude to other users of this server is unacceptable.
:incoming_envelope: :ok_hand: applied ban to @astral mural until <t:1753998034:f> (14 days).
Not a problem, thanks for letting us know <3
Insane beef in python discord 💀
:(
Do you have any ideas why discord is not updating my bot?
I added a couple new commands and it simply doesnt update
Uh did you sync it
Tbh first time making a bot, I mean I restarted the python program that runs the bot and that has a sync in it so theoretically yes but kinda new to this
Is there like a way to force sync the bot?
can we see the part that syncs it?
I think ideally it should be its own command, and shouldn't happen when the bot is started
# --- On Ready ---
@client.event
async def on_ready():
await tree.sync()
print(f":white_check_mark: Logged in as {client.user}")
client.run(TOKEN)
It says tree.sync so Im guessing it syncs before starting
and what is tree?
# --- /map Command ---
@tree.command(name="map", description="Get RustMaps link via BattleMetrics")
@app_commands.describe(name="Name of the linked server")
async def map_cmd(interaction: discord.Interaction, name: str):
if name not in servers:
await interaction.response.send_message("❌ Server name not found. Use `/link` first.")
return
ip = servers[name]["ip"]
port = int(servers[name]["port"])
await interaction.response.defer()
try:
async with aiohttp.ClientSession() as session:
api_url = f"https://api.battlemetrics.com/servers?filter[game]=rust&filter[search]={ip}:{port}"
async with session.get(api_url) as resp:
data = await resp.json()
for server in data.get("data", []):
attr = server["attributes"]
if attr.get("ip") == ip and attr.get("port") == port:
server_id = server["id"]
html_url = f"https://www.battlemetrics.com/servers/rust/{server_id}"
async with session.get(html_url) as page_resp:
html_content = await page_resp.text()
soup = BeautifulSoup(html_content, "html.parser")
for a in soup.find_all("a", href=True):
if "rustmaps.com/map/" in a["href"]:
await interaction.followup.send(f"🗺️ RustMaps link: {a['href']}")
return
await interaction.followup.send(f"⚠️ RustMaps link not found.\n🔗 {html_url}")
return
await interaction.followup.send("❌ Exact IP/port match not found in BattleMetrics.")
except Exception as e:
await interaction.followup.send(f"❌ Exception: {type(e).__name__}: {e}")
This is one of the commands
did you just do tree = bot.tree?
Nope, I made an object asigned to tree like
tree = app_commands.CommandTree(client)
hm
I mean I got no errors or anything, I googled why my bot isnt updating all it said that commonly used bots may take longer to update because they are in a lot of servers and every single servers integrations get edited one-by-one appereantly
But I only have this bot in 1 server
I would definitely move the sync outside of on_ready at some point
since that can fire randomly. You might get rate limited
I would maybe try with bot.tree rather than this
just for troubleshooting. Not to say it's not valid
Also I am guessing discord is just tweaking cause the bot went back to its old profile pic even though I changed it like a couple hours ago
Make sure you're always refreshing your discord client, too
also that call will return the commands that got synced. So I would print that and inspect it
good call, ima try maybe that works
WTF
Appereantly now the commands are there
👍
Love this app 🙂
Just had to update the client then I guess
I mean think about how it would be if it were fetching commands all the time
It wouldn't make sense
Given how rarely commands change these are heavily cached
Does discord.py remove all commands and readd them when you sync?
Or does it use upsert?
discord/app_commands/tree.py line 1129
data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload)```
Bulk overwrites yes https://discord.com/developers/docs/interactions/application-commands#bulk-overwrite-global-application-commands
Discord handles the rest
What would you call a function that monitors someone's activity/messages in a server?
I guess /track @user and /untrack @user
The Python Bot is using something similar
https://github.com/python-discord/bot/blob/main/bot/exts/moderation/watchchannels/bigbrother.py
Probably worth reading over the tos and dev policy
I mean it depends on what you do with it
using it for moderation purposes in your server is fine if done with proper transparancy but using it to harass/profile someone is obviously not allowed
I'd give this a read
I was more referring to the section of "don't circumvent discord privacy features", of which a user's right to delete their messages is a privacy feature
But especially if you do this without consent or even notice, that's scummy
You are just making things up which makes you sound arrogant nothing else
Obviously for moderation purposes but instead of using Dyno or MEE6
They're not though lol
There are constraints when storing deleted/edited messages
I'm not making up discord developer policy
The fact that so many bots get away with it doesn't mean it's not in the policy
There is nothing there that makes exceptions for "moderation". It states to not circumvent privacy features, and my ability to have my message deleted when I ask for it to be deleted is a privacy feature.
I remember us having this conversation a few months ago already and I'm not interested in arguing with someone who isn't ready to be convinced
I'm not completely against you but you can very easily argue that #15 allows for logging messages sent in the server if 1) they're for the application's functionality (in this case moderation) and 2) not stored for any longer than theyre needed
I'm not referring to that clause
- Do not enable your Application to bypass or circumvent Discord’s privacy, safety, and/or security features.
Unless a clause says it is an exception to another clause, it doesn't limit the other clause
They are additive
Clause 3 says don't do X. Another clause doesnt somehow limit what X is
You can really only argue that these features don't violate clause 3 is if you believe that a user's ability to have their messages permanently deleted isn't a privacy feature
Here is a link if you are unaware of how moderation works:
https://discord.com/safety/creating-moderation-team-channels
How does some random article pertain to the developer policy
Again. How does this article change the wording of an official document
^^
I'm willing to be convinced but you actually have to address the thing in question, the developer policy, instead of diverting to random irrelevant examples
Discord inconsistently enforced their own tos all the time. That doesn't change whether or not that thing is compliant with the tos
I mean Discord has not clearly stated what they classify as a Privacy Feature unlike other things they have clearly stated in their community guidelines, and also them not taking action against a single "message logging" bot (that I know of), and also them promoting moderation logs like in the article above (which I've seen for the first time); I wouldn't blame anyone if they consider message logging fine...
Simply because you're comparing apples and oranges
Nothing in the policy, specifically that clause, makes exceptions for moderation
You can argue that my ability to have my messages deleted isn't a supported privacy feature, but listen to yourself when you say that
And even then, that doesnt supersede gdpr if a gdpr protected user instructs a developer to delete any associated data and cease collecting it
that's a completely different topic, nobody's arguing about that
as long as Discord does not define what a privacy feature is, its "your word against my word" and it literally does not matter
You can apply common sense and ethics. If you're going to argue that a user's ability to delete their messages isn't a privacy feature, you have to stand by that
I don't understand your point to be fair, you originally recommended them to read the ToS and developer policy, but "common sense" and "ethics" aren't definitive legal terms
being right on legal terms is completely different than being right on moral terms
So your point is that clause 3 is completely useless and unenforceable because discord have not exclusively listed out exactly what privacy and safety features are?
No that's just your assumption, clause 3 is necessary for what Discord has stated in Clause 3: Your Application must respect user decisions to opt out of or block the Application, as applicable. Your Application must respect users’ ability to remove the Application from spaces (e.g., servers or channels) where it is present.
Everything else can be argued legally
The heading of that section is broad, and those sentences are specific examples and not limitations. I get where you're coming from, but there's no good faith argument that allowing a user to have something they said get removed isn't a privacy feature. It is a feature, and it enhances a user's privacy.
There are ways to allow for moderation that don't effectively remove my delete message button
Again there's no point in discussing if deleting messages is a privacy feature or not, that's totally upto discord and any parties they may sue.
The main point is that logging deleted messages for a purpose, with subject to the other guidelines, does not directly go against any developer policy, and is thus not "against the developer policy"
I am not and will never say deleting messages is not a privacy feature
I guess the question is: Does copying of some messages to a hidden moderation channel constitute bypassing of this feature.
Me not saying it's not a privacy feature does not mean I said it's a privacy feature... there's a "yes", "no" and "abstain".
I do not need to say if I think it's a privacy feature or not because it doesn't have any real value. It only has real value in court where every argument actually matters
This isn't a legally binding document. It's a policy.
There is no courts, it's up to discord to selectively enforce
This is the actual meaningful operative question. And I would add that it's important when this is done permanently with the user's info attached

The reasonable user expectation is that when I hit delete, that message (eventually) is removed from discord. Not that it's preserved for an effectively random subset of people without my direct consent or even awareness
Yeah, and I think Discord publishing an article in which they describe exactly that in a positive light seems to indicate to me that at least Discord thinks the answer is "no".
Discord's enforcement actions are notoriously tangential to the wording and any sane interpretation of their policy. Mee6 continues to exist despite committing financial fraud
(It's also the case that I highly doubt the people writing these help articles even talk to the legal folks who are drafting the policies but that's a whole other can of worms of corporate incompetence. Either way if there are asterisks on the supported privacy feature that are never communicated to users I think that's scummy and unethical personally)
That is how it works. Bots can't change this
In the absence of bots, afaik it's only the T&S team that can view messages and even then they have to get retentioned away eventually due to GDPR. Bots permanently posting it in a channel for any random discord mod (not subject to any oversight or regulations) to view whenever they want is a pretty substantial change I'd say
this expectation should probably be changed, since the majority of servers are keeping permanent logs of deleted / editied messages. It would keep more users safer if the expectation that delete via discord just moved it from a public message to a more private one
but realistically, a bot preserving your message is no different from a user just screenshotting your message and storing that
Ideally then it would be baked into discord and made abundantly clear what that button does, rather than it being implemented in several different ways by different bots (that can be retroactively added) without telling you or asking for consent.
And while true, the scale at which individuals can/do that is tiny compared to what bots are capable of
Bots can post whatever they want. There is no way for you to guarantee that the content was from the user
Developers have responsibilities on how they handle user data, regardless of whether or not they can definitively prove it is user data to the point where they're mishandling it
what am i reading? ah yes, arguments!
Just my two cents here but as far as i can tell, deleting a message is not a form of privacy. if it was, the entire idea of lost connections makes it completely unreliable.
I personally would not want someone to bypass moderation by deleting a message after its sent but before its reviewed (spam style rule breaking)
there may be the issue of it circumventing the privacy policy, if it were part of the privacy policy in the first place, i assume that "deleting a message is is a form of privacy" isnt in there, is it?
as far as I can tell, the "privacy and safety features" spelled out in the dev policy aren't enumerated anywhere
There are ways of allowing for moderation without infringing on the privacy feature. But these lazy "copy paste message forever" opt to not do that
let me ask you an analogous question:
would screenshotting this convo, moments before you delete a silly message, be privacy invasion?
applications are not subject to the same requirements as humans
just because a human can do x does not mean it's okay for a bot to do x
its a question you cant even answer?
It's a question that's irrelevant to the conversation
He just answered it
analogies are used to expose or convey relevance and such
"privacy invasion" wasn't even a term anyone used
this is relevant cause it is privacy
so no, I don't think it's a "privacy invasion" but that term doesn't mean anything
sorry, breach of privacy"
same thing
go argue with your parents lol
The point being made was that it's a circumvention of a supported privacy feature
and if you read the conversation, bots doing something is not remotely a signal that it's ethical or compliant with the policy
circumventing moderation via message deleting is not allowed in many places
almost any iirc
can i say something racist here then delete it before getting punished?
Please actually read this before making tired points
i read the entire thread right from him asking a bot that tracks users
no you should not retain messages forever but in the same sense, sending that message to a channel labeled "deleted messages" would not violate that as it isnt retained forever, it is retained for as long as the moderation team may possibly need it
i.e. the lifetime of the server/guild
That is not a reasonable retention period by any sane evaluation
tell discord to stipulate then
as far as i can tell, you expect a deleted message to be deleted world wide, as though youre a crack team of gov hackers that purged the world of that data
They do in their developer policy. They just neglect to actually enforce anything that doesn't actively impact their bottom line
where do they say not to retain messages at all anyways?
Do not enable your Application to bypass or circumvent Discord’s privacy, safety, and/or security features.
You can re-read the conversation on whether or not the ability to have a message deleted from being read is a privacy feature
The wording of that implies that there are native features in discord which provide privacy, safety, and security. This clause is telling application developers to not interfere with those features
deleting a message in my opiniono is not related to privacy except in that it should not be viewed as a form of privacy
That's an opinion you are welcome to but one I vehemently disagree with (and privacy frameworks like GDPR would as well)
entering any server, you agree to their rules, and that includes the moderation
If a server provided a rule stating the conditions under which my messages would be retained, sure
people however don't do that
Discord provides features that do things. If a bot in its operation changes what those features do, that is by definition circumventing it.
I'm not assuming anything. The delete message feature does something, and these bots silently augment what it does.
You're welcome to your opinion on whether or not people deserve inherent privacy, but that's an entirely separate conversation to what the dev policy actually says and what the native features actually do. It's a tired conversation though and people are going to interpret that text how they want. I still hold that there are ways where everyone wins here and moderation can happen without infringing on privacy, but people for some reason refuse to actually address that point
privacy policy, page 6
even discord has a legal obligation to retain deleted data in some cases
Yes. They have a legal obligation to retain that data, record when it is accessed, and limit that access to a supervised and highly accountable team
for a limited period of time
if someone comes into your server bragging of being a pedo, then deletes said messages, would you like to retain evidence as the sole reporter to the authorities (granted that you report it)
Again. You can do that without logging identifiable messages forever. This isn't an either/or and you can cut the false dichotomies
you cant assume privacy where it isnt implied explicitly
Pretty sure most logging bots dont retain messages forever
Again, I am not assuming anything. I have identified a privacy feature and bots circumventing that privacy feature
how could they
Every single one I've seen does
and again, sending to a channel isnt permanent retention
^ the bot is not storing data it sends to a channel
How do you define permanent
beyond my death and my childrens and into the forseeable future
do you see it as tomoorrow?
if anything, the bot is doing the exact thing you want, it is retaining your message in memory until it is deleted, then it is sent to the final place for deleted messages (typically a admin / moderator channel)
And that is augmenting what the native delete message feature does without my consent
after its sent to that channel, it isnt ever in the bots process again
like you keep talking around the point that this is literally what the dev policy says not to do
deleting a message ~ privacy
channels ~ permanent retention
moderation = tracking members + their content
simple as day
"we dont control them or waht information they collect"
need to follow all policies that apply to them
keep reading ignoranus
Which later part negates that statement
if i have a privacy policy of my own and i state that i retain your messages for perpetuity, and you use the server, you agree to my terms/policy
that is a fact
Not if it violates policy
what policy?
.
youre not worth talking to, its like telling a brick wall it can fall
you know im right but you choose to stand your ground to the end of the earth
a discord employee could come here and agree with me and youd argue with them
I do not know you're right because you refuse to actually address that point and talk around it
goodbye, enjoy argueing with the next person that steps on your bridge
👋
have a noce day pirate
You have a great day too!
I love the argument of ambiguous thing that is not well defined
This is my stand:
I would not assume delete message is a privacy feature against everyone, it would only be a privacy feature for most people, which isn't trust to moderate the server, and I have the expectation that users who previously read the message, the moderator and discord would be able to read the message permanently despite I deleted the message because that's how internet work.
The really funny thing is that there are vastly more ethical ways to do this, but for some reason these people arguing refuse to even consider that because it takes a few extra neurons to code it properly
Please enlighten?
- Add reasonable retention periods
- Don't expose the user unless action needs to be taken, if it's reviewed as a fine message nobody needs to know who sent it
- Have a mechanism for informing users that this will be done, give them a way to flag a truly sensitive message they want gone-gone
- Is normal message caching too long of a retention period for you?
- So basically just require an extra click for moderators or limit the ability to moderate continuous troublemakers
- Sure, but the only way that that system could not be abused is if you ban the user who requests this
- What caching? Like in local clients? That's really, really short. There is clearly some middle ground between "message is gone instantly" and "message exists and can be read until the heat death of the universe or the server owner chooses to close the server"
- It's not an extra click every time. It is a click when action needs to be taken. One click does not severely limit anyone's ability to moderate. The T&S team have to go through way, way more hoops to dig up deleted messages. Heck, you could even combine that click with moderation actions too if you're worried about pure efficiency.
- How do you envision that being abused? It is purely up to the server team to remove people from the server, they can do that at any time for any reason they want. It's hard to abuse a system when that behavior is being logged and can be very quickly responded to.
The issue is why would you send a truly sensitive message:
- If for yourself, not in discord?
- If for a specific person, DM?
- If for a specific group of people, group chat?
If for everyone in the server, then it really isn't sensitive
But instead you decide to send it in a server in which you don't control
- I mean logging bots do not store message content, they resend it to discord and do not maintain a link to that message.
- How do you know if action needs to be taken on a offense that is not committed in the message content. IE spam.
- I send bad message -> I delete bad message -> I mark it that I want it "gone-gone"
- The bot handles the request and I got away with my bad message
- The moderators approve the request after already being able to see the message, which kinda defeats the point
- Whether they "store" it or not is entirely pedantic. They are making the message available (and identifiable to a user) when it otherwise would not be. The default behavior of
delete messagedoes x, and these bots make y happen. They could very easily delete that message after a reasonable retention period where they have elected to send it even if it's nottechnicallybeing storedbythem. What this period is, that's up for debate but is a good faith discussion to have when it's notindefinite - That's a good point, but could be implemented as another check.
X user sent Y <similar/same> messages in this time periodis hardly a sensitive thing that I don't think anyone could have privacy concerns with. - The point isn't just that moderators ever see it. The problem is with it being retained for perpetuity. These things matter. Even if you can't eliminate the chance of someone seeing it, it's still valuable and important to minimize the chance of that being used later. Retention periods are made to mitigate, not fully erase chances of privacy issues.
Have you implemented one that you consider more ethical?
I've thought about it, but I don't typically engage in open communities where people deleting messages is an issue for me. If it were up to me, if someone has bad vibes and is deleting/editing stuff on the regular I just boot them
would be a fun project that wouldn't take too long though for folks that need that process
the main point here is that bot developers must create and supply a posting of their privacy policy.
the policy is legally binding agreement between the member of the guild and the bot/server owner.
as per the laws in the EU, they state the user must be aware (by reading the policy) of data collection, they must have a process to request deletion of data and they must retain said data only for purposes outlined in the policy.
this is typically done in that the server owners can respond to requests, or set up a system, and the policy is a must anyways, regardless of the data type.
just because you didnt read the policy of the 3rd party bot, doesnt mean you dont agree, your participation is a show of agreement.
lets not forget how the law usually works here, anyone can make a virus, the criminal is the person that uses it for criminal activity.
additional note for the EU law point, they must also define the period of retention and disclose that period length to the user
another side note:
GDPR doesn't apply to individuals using bots as they aren't businesses, and GDPR is focused on businesses
this entirely falls under the bot owners policy and the server owners use of the bot. if the bot doesnt store anything but gives the ability to resend it for storage on discord servers, it is up to the server owner to have a privacy policy setup to ensure they align with the many laws around the world.
as a bot dev, you ensure your service is "up to code" and the server owner has to ensure their onboarding is "up to code" and the member has to ensure they read privacy policies and onboarding rules/policies/postings.
server A admin has it set to send to "admin logs" or something
bot A now has no data in its server, it is in discord again as part of retention.
server A owner now has the role of the data holder; preventing misuse, leaks etc.
the user had to have been given notice that messages are retained, the reason, the duration etc.
the bot is void of responsibility
the server owner is entirely responsible for the safe handling and storage of the data```
i wonder if any of these retain messages?
Note that Discord do specific require your bot to follow GDPR, whcih is why it was discussed
Yes
this is news to me, i wasnt aware it was defined in the tos and policies, i always just run off the idea of abiding by my local laws and international laws.
guess ill have to actually read the damn thing eh
yes you actually do need to read it
sad that i need a lawyer just to run a discord bot these days
Well, basically no one would care if you are small enough and/or not doing something very weird
oh im small alright 😉
I mean the scale of operation of the discord bot
sure you did lol
agree 100% btw, i just think the term weird is open ended in that what i may veiw as weird may not be the general opinion
personally, i join a server, i assume theres moderation going on, from tracking deleted messages to tracking users joining from the same invite, and getting banned, therefore freezing that invite. its pointless to count the ways of preventative and retroactive moderations. theres methods not even thought up yet
a good analogy i just thought of is joining a server is like entering a house party, you arent in control, if you want to be in control, throw your own and host a server with your own rules
big diff in the analogy is that servers are internationally accessible, unlike a house. but i still think its a valuable view.
just gotta add the laws for the people that are there
in this case, post a big sign saying "read this policy i write" at the front door when people enter the house
The ask here is just that people are transparent about what they're doing, and to take the bare minimum precautions to not infringe on privacy beyond what's actually needed for moderation. It's not a big ask
and yes, you should read the tos and dev policy before having discussions about it lol
i skim through it just like you
I have read it extensively
damn, and youre still using opinions in place of fact
maybe i dont need to read it after all, i just need to align my ideals with yours
I mean that clause is realistically very ambigious as they usually are
Ultimately the big difference between the policy and the tos is that the policy is just guidelines that they use to inform how they enforce. They're not binding, nor do they need to be
why it allows for much broader, subjective language
if you use my bot, you agree to the policy i set out. its that simple
Your policy cannot override discord's policy, which is the point I was making
that would be a step up though as a vast majority of bots don't even describe this functionality in their privacy policy
discords policy? which is what exactly (pertaining to bots)
the part where they state bots are 3rd parties and they dont interfere with them?
The clause of the developer policy I have referenced multiple times but we don't need to go over that again
I think we still don't agree with each other of Service Provider require a specific written notice to the developer or just Privacy Policy that comply with discord requirement is good enough lol in the dev ToS
But that general point still stands that your privacy policy does not allow you to violate terms in the tos or dev policy just because a user agrees to it
You agree that your privacy policy may not and will not supersede, modify, or be inconsistent with the Terms, which will supersede if there is any conflict or inconsistency with your privacy policy. You will maintain publicly available, up-to-date links to your privacy policy in the Developer Portal and make it easily accessible to users from your Application.
Service providers are spelled out in the TOS, and to be honest that specific clause is vague. Though I have yet to find a SP that actually has a general policy specifically saying they will follow discord's TOS, minus SP's specifically tailored for discord (like botghost did)
Otherwise good luck exhaustively going through the discord TOS and ensuring there is a equivalent clause in the SP's TOS lol
I mean one that comply with discord requirement
such as the service that just doesn't log anything
The SP clause says that SP's have to follow all discord TOS on your behalf (and say they will in writing). You can't pick and choose ones you care about
heres an example:
https://unbelievaboat.com/privacy
It is incredibly unlikely a general purpose TOS would match up with discord's 1:1 unless it was tailor made specifically to be a SP for discord, but I guess it could happen
I am pretty sure I ask an API for e.g. what pokemon(imginary) stats base on user slash command input, and the api return the pokemon stats without logging anything would fully comply discord ToS and privacy policy requirement
It wouldn't if they don't comply with all of discord's terms, and you don't know if they do unless they tell you they do.
For surface area that small discord has a 0.00001% chance of caring. But that is API data by the definitions of the terms, and this API is a third party unless they're agreeing to all of discord's terms with the data you're handing them
i feel like this bot wouldnt exist for the past 5 years with the same privacy policy if it werent up to the terms of discord
The only thing they can do with the pokeman name I send from API data to the pokeman API is log it
and they stated they don't log it in the privacy policy
So...
share with third party, or even nebulously to use that data "for no other purpose (including their own)"
think about this for a seconds, bots are being verified by discord, while doing what you state breaches the policy/tos
who is wrong, discord or you
Yep, I just forgot to stated shared with third party because I just implicit thought no-log -> no share with third party when it is not always true
The "no other purpose" bit is deliberately vague. In theory if they took their data and like trained a model on it, ran generalized analytics, etc etc that would not be serving your application and disqualify them as a service provider
again no log, therefore if they took the data it mean they log the data
well "log" is pretty vague here too
wait wait wait
Any mean of storing the data after returning the result in retrieveable way
i cant use discord to train an ai?
If you hash it and use it to feed a model, is that logging?
not if you cant get that data back no
Using message content to train a model is deliberately called out in the dev policy very directly lol, not sure if that was sarcastic or not
if the hash can be used to retrieve or uniquely identify the name, yes
arguable if it needs to be 1-1 replication of the data but it wouldnt be the same data, not likely anyways
very sarcastic lol
The service provider clause prohibits them from using that data for any purpose beyond serving your application. It doesn't care if the data is retrievable or not
no, I just figure out a pokemon name from a slash command would be a nice example that an API don't need to log anything
my bot is a llm, like gpt
your messages train it
therefore its within scope
lol
What could you train from hash of pokemon name... (also the fact that pokemon name is finite and therefore retrieveable is a form of logging)
The pokemon api example is such a simple example that this is less of a practical question and more of a rules lawyer question. Whether or not they're a Service Provider, it's such a small use case using such a small sliver of deliberately supplied data that there's no chance they'd bother to enforce that clause. Just like if you have a bot that plays the happy birthday song in VC, that is technically copyrighted but they're not going to do anything about it
yep
This was exactly for the purpose you stated
On the flip side, there's absolutely 0 harm and 0.00003% effort to just tell your users you're sending to a third party and treat it like a third party rather than a SP
when a user of your Application expressly directs you to share their API Data with the third party (and you will provide us proof thereof upon request).
Technically it require me to verifiably store the proof of the user agree me to send the API data(pokemon name) to the third party
Hmm
Yeah that clause is also a bit vague. If you just put it in the command that it goes to this third party api, is that sufficient? 
I would say expressly directs you and provide us proof suggest it is not
I make the user agree to this statement, per guild, via a button press. It is specific to my use case. I store their agreement along with a datetime in my DB.
Before You Can Continue!
By clicking the "Confirm" button you consent to the Bot sharing your responses with the Creator of the Survey and any other Users the Creator has allowed access. This agreement extends to all future submissions in this Server. You can revoke this consent by joining the support server and requesting your consent to be revoked. If consent is revoked it will only apply to future submissions and any existing submissions will still be able to be shared with the Creator. If you do not wish to consent you will not be able to participate in any surveys, but can choose to consent at any point in the future by attempting to respond to a survey.
-# Some terminology is used in this agreement. The definitions of each term can be found in the TOS or Privacy Policy
Dang that's pretty solid
Nice
after 1-2 minutes of not using my ui buttons i have a message that This interaction failed
can i fix that?
set the timeout to None
is it better to make a timeout at 60 seconds , otherwise bot autoplay(this is a game)
not too sure what your use case is here, you'd have to be more specific
eg i have to choose button 1 and button 2
after 60 secodns of not choosing anything then bot will autochoose for you
sure
Hello, can anyone help me with a discord bot?
I have 2 issues, first one is that my script is supposted to sent a message every 10sec in a specific channel, but when i am running it it will not work. Second is that one of my two ticket sistems isnt working because when i run my command it will say command not found
I can provide my bot files in dms
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
Can someone explain how to start tasks in cogs? The Discord.py documentation starts the task in the __init__ constructor, but at the same time it recommends that cogs should be loaded before calling bot.run(). Combining these two means the task tries to start before the bot is actually running, so it doesn’t work
There is a recipe in the tasks documentation spelling out that case
The problem isn't inherently tasks starting before the bot's connected, it's those tasks relying on a connection
But the task doesn't even start; the print() in the first line of the task isn't executed
And the wait_until_ready in the before_loop gives:
Client has not been properly initialised. Please use the login method or asynchronous context manager before calling this method (silently)
It doesn't recommend that cogs are loaded before bot.run.
You need to start the event loop before you do any of that
class Tasks(discord.ext.commands.Cog):
def init(self, bot):
self.bot = bot
...
if not self.task.is_running():
self.task.start()
@tasks.loop(seconds=10)
async def task(self):
print(0)
...
print(1)
I've tried other ways before, but this is the current main one, and I also kept the names generic
Can you show how you create/load this cog?
!d discord.ext.tasks.Loop.start
start(*args, **kwargs)```
Starts the internal task in the event loop.
async def load_extension():
cogs_path = bot_path / "cogs"
cogs_relative_path = cogs_path.relative_to(bot_path)
for path in cogs_relative_path.rglob("*.py"):
module = str(path).replace("/", ".").replace("\\", ".")
module = module[:-3]
await bot.load_extension(module)
asyncio.run(load_extension())
bot.run(TOKEN)
You should do this in your bot's setup_hook, not a separate aysncio.run
Thanks, it worked! I thought setup_hook was the same as loading things manually
setup_hook runs after login but before connect.
Your previous code tried to load extensions before your bot had even been opened as an async context manager
Makes sense
Show your code
Dm me 🙏
k
Why not yet send it here lol
Can y help me maybe? 😄
Yes, with?

I wanna create a role ping for rare pokemon spawn in my discord pokemon catch detection bot. Will this be hard to do?
"Hard" is entirely relative
I don’t understand how to pull the image information from the pokemon bot so that my bot can read it. Im fairly new to this stuff. So just looking for some pointers i guess
I would contact the owners of this bot and ask them what kind of api you can use to interface with their bot
Otherwise anything you build is a guess that can break at any moment
Ahh yes, i was thinking about grabbing all the images from the bot and hosting them on my vps.
But i was told by someone that the image hash changes sometimes
That's not at all what I said but sure
You can get the images from this showcase bot for cv2
https://github.com/DV8FromTheWorld/discord-pokedex/tree/main/pokemon-data/images
I dont think they will get back to me on that. That’s why i said i was thinking of hosting the images but ive dmed them and will see what they say
I'm not referring to images. "spawn" is something you're just guessing at, they can change how their bot behaves at any point
Hellooo, so im new to discord bot programming, and i was wondering whats the best way to make a discord bot using discord.py, bcuz i've seen MyClient stuff and bot = commands.bot and idk which one to use
discord.py offers you two base classes to use: Client is a barebones implementation of the discord API, and bot is a custom subclass that layers on helpful infrastructure (like extensions and "prefix" (message based) commands)
So what's the best way to make a discord bot?
Do u have smth like a repo or a yt video?
I would recommend the examples in the repository and the documentation
anything not made and updated by the library maintainers is just some rando making stuff up on their own
I mean in the repo and documentation there are examples of both i mentiones
So you make an informed decision on which one you want, then follow those examples
Given they share an inheritance, it's also not really difficult at all to switch between them
have u made a dc bot i could check? im checking the server Python Bot to give me some ideas
or a tuto
I don't make my code public, and I don't personally recommend existing bots as they are all injected with the writer's personal practices and sometimes antipatterns. I only recommend the examples in the repo, and perhaps R. Danny which is made by the creator of d.py
Ok i see, thanks for ur help, i rlly appreciate it
Others will have different opinions and you may find other resources helpful. If something doesn't make sense in the documenation, I'd recommend asking either here or in the support server for the library you choose (they all have one afaik). That way you can get multiple eyes on it, rather than following a tutorial which are often just wrong
Also quick question i just remembered, what are cogs and they're use? i dont understand them
Cogs are just ways of grouping together pieces of functionality that you want to load into the bot together (atomically). Like if you had 5 commands you wanted to load together along with a task loop, and to load all of them at the same time and maybe unload all of them
wut?
People often mistake cogs for extensions, which are a completely separate concept. An extension is a way of splitting code into multiple files for hygiene or dependency structures
like adding all of them to the same instance (smth like that?)
More like more cleanly enabling parts of your bot together
flip a switch (add a cog) -> bot gets these 5 commands enabled + has these 2 task loops running -> flip the switch again (unload the cog) -> all of those turn off
like a tree with different leaves and the cogs are the branches?
I suppose that's one way of looking at it yeah
lol its what came to my mind
it just lets you pick groupings of stuff you would add into your bot, and you can add/remove that stuff together
ahhh i see
The most common things are commands, tasks, and listeners but it could really be any arbitrary stuff you'd enable on the bot
Yeah I don't mind pings, lots of folks around can help too
ye ofc
He said it doesn’t use an api and “but its also the simplest method and so almost every bot has a method to prevent hash from working” when i mentioned something about hash
I guess for autocatcher purposes

Do the bot owners not want you having spawn detectors? I thought these bots operate separately per server (activity on one server does not effect you elsewhere)
I asked him if it was allowed and he said yes
He said id have to basically make an autocatcher function, but instead of calling a catch command i can use it as a role ping instead
If they want you to build off their bot, they'd provide you a reasonable API to use
If they asked and got permission I see no reason why they shouldent do it. It is likely that the dev would not want to spend time creating an API for one person when that person has a potential way to do what they want already.
Basically what he said
He said extra work for little to no gain
Mainly because if they're relying on unsupported behavior, then whatever they build can break without notice. Unless the dev is like putting in stone that they're never changing their display logic, but nobody with 3 neurons is going to give you that promise. I'm not saying they can't, just that if you build something that you don't care about randomly breaking then I dunno what to tell you
Yea the spawns change periodically i assume
So now i guess ill be looking into autocatching functions? Idk
these bots are like, 7-8 years old? and they all use the official artworks. Sure they could still change but one would still get use out of it for quite a while before it changes
Do you know a fair bit about this that you can point me in the right direction. I see you are in the same pokemon bot server that im mentioning
Probably, what were you wanting to know? I dont have an answer to your original question of reading images since i never tried, but if you have other related questions
Though for just logging catches you can just use the text the pokebot sends, i did make a bot for that then never used it
I have a catch logger and shiny catch logger already
I guess he said i have to make basically an autocatcher. But instead of my bot catching it sends a role ping thus changing it from a self bot to a role ping bot
One of my friends who got banned for autocatching said he wont share how he does it but before he said that he said he uses something like pytorch and huggingface? Idk what those are
well yea he means that your output should change
an AC will get the answer and then type p!c pokemon
but your bot should get the answer then send it in the channel
unless i had spoken to the person i would just assume someone else gave them the bot and they just ran it
you could maybe try and track down the person that made poketox, i dont think that runs anymore so they may be more winning to help you
I trust that he did it. He made his own pokemon bot to copy the one im playing
I dont even know what that bot is lol
its the same bot youre trying to make, worked with P2
Its not pokename now? Or p2a (poketwo assistant)?
yea theyre effectively all the same
you could just ask them if you havent already too
Yea those guys generally dont like to share their code haha
Guess ill have to do some google searching
sharing code is different than asking how to read images
I just found a youtube video that shares an autocatcher code via github
For p2
Yea its insane. Its so botted my friend says
They posted the ac on a public github
But the video is a year old and i cant see the full github link
That was no help lol its all ran on a powershell with json and bat files
This isn't a selfbot right....
No most definitely not
It uses the same listening commands and sending commads as a AC but instead of sending a catch command when a rare Pokemon spawns it sends a role ping
Self botting is against the ToS and im not dumb enough to risk it
Wdym by self bot? Im sry pretty new. But if it violates a TOS I would like to know what to avoid.
Using a user token instead of a bot token. It is not really something you can accidentally do unless you are blindly following a sketchy tutorial.
👍 that's what I thought but wanted to make sure
Definitely is a bot token and comes up as app when logged in lol
setdefault vs defaultdict? Which one is better to use with a asyncio lock?
both should be fine honestly up to your preference, whats the scenario here asyncio lock is to make sure basically only one coro can access a resource at a time
Yeah that's what I'm aiming for
To avoid race conditions on a specific key
get defaults to None fwiw
how do i make a discord bot in python
Well for starters, how much python do you know?
Infinite
Me: docker compose up
you just make it
@fast osprey well i know a lot(advanced) like databases data science with matplotlib and tkinter, flask
But how much core python do you know? Do you know how to make classes/general OOP? Do you know how asyncio works?
Guys, when I click on the send button is it just like a post request with a json body for example {"message“:message} and then it goes to the backend where the request is being processed? So bots are like users like me that just send requests automated with python or other languages?
Bot accounts are for most purposes just users, like humans. There are however limitations on both
But yes, when you click send on your local discord app that does result in an http post being sent to discord. Though as a bot developer, you really should not be concerned with what the user discord app is doing
yes
Hello! Why is it not counting my "send_message" here?
pretty sure it's a pycharm bug, you code should work fine
Let me see.
My slash command isn't showing up tho.
you gotta sync it then restart discoerd
Ohh right I forgot lol.
Now why is it only sending one message?
send_message isn't a method of Interaction
It's a method of the InteractionResponse and it can only be used once
Then what should I do? with the .response it still won't work.
I see.
By "it won't work", do you have an error?
No.
