#discord-bots

1 messages · Page 412 of 1

fast osprey
#

For which library? Or are you hitting the API raw yourself

sly lotus
#

Sorry I forgot to precise, right now I'm using discord.py

fast osprey
sly lotus
#

Alright, thanks for the answer.

radiant shuttle
#

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))
fast osprey
#

What library are you using?

radiant shuttle
#

in the main file you mean or what?

fast osprey
#

No, what discord library are you using

radiant shuttle
#

2.5.2

fast osprey
#

that's a version

#

which library?

radiant shuttle
#
import discord
from discord.ext import commands
fast osprey
#

multiple libraries use that import

radiant shuttle
#

yes but the same way i created all my other slash command files worked

#

this is not working

fast osprey
#

I'm asking you which library you're using

full ether
#

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

fast osprey
#

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)

radiant shuttle
fast osprey
sacred wind
#

how do I delete the old slash command?

quick gust
#

Youll need to prove more context

sacred wind
#

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)

slate swift
#

Like fully close task manager it

sacred wind
slate swift
#

You can try resetting the bot token

sacred wind
fast osprey
#

What library are you using?

sacred wind
woeful hill
#

again we dont know what library just with that namespace

fast osprey
dreamy dune
timber dragon
#

A token reset removing all your app commands would be so annoying lmfao

sacred wind
#

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.

#

❤️

fast osprey
#

Do you know what library you're using yet

ivory turret
#

and restart your discord

fast osprey
#

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

verbal arch
#

Ive never used python before, anythiing i should know before i use a script

stark ingot
#

A discord bot script? Or a script in general? Also what script?

verbal arch
#

idk what script yet

#

Would i be messed up for scamming back what my friend got scammed for?

stark ingot
#

Well this is the discord bots channel...

verbal arch
#

lol

sick birch
verbal arch
#

im just trying to get back what was scammed nothing else

sick birch
#

we won't help with that then

wheat zephyr
#

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

▶ Play video
fast osprey
#

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

pallid turtle
#

I misunderstood the scope of the question. Pardon my morning brain.

tender bobcat
#

Maybe if you are in EU, you could probably use GDPR to force ask Discord to delete them?

quick gust
#

You don't need to be in EU for that

stark ingot
#

Or just don't send things on discord that you don't want to be on discord

quick gust
#

That's not a solution, it's a precaution

Regardless its outside the scope of this channel

glad salmon
#

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

quick gust
#

Send the complete error and the relevant code here

#

!paste

unkempt canyonBOT
#
Pasting large amounts of 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.

glad salmon
#

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?

quick gust
#

You'll have to explain what's not working

glad salmon
fast osprey
#

You should avoid dming people if not needed, especially for things they themselves didn't initiate

glad salmon
fast osprey
#

They can submit things to the bot without the bot dming them unprompted

glad salmon
fast osprey
#

You're already using modals, they could fill out a modal

quick gust
#

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

glad salmon
quick gust
#

Well surely they sign up for an interview somewhere right?

glad salmon
fast osprey
#

What is the DM actually serving? To gather information or just to notify them

glad salmon
fast osprey
#

yeah I'd recommend having them input that in a command rather than cold dming them

quick gust
#

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

glad salmon
fast osprey
#

or a database

#

sounds like you have bigger issues if you are getting routinely nuked

quick gust
glad salmon
glad salmon
quick gust
#

Sure, just use a database to make it easier

glad salmon
quick gust
#

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

glad salmon
quick gust
#

Google sheets isn't supposed to store data

#

Use an actual database for that

glad salmon
quick gust
#

Yeah start with sqlite/aiosqlite, its simple and works well for small scale operations

#

Make sure you understand SQL though

glad salmon
quick gust
#

SQLite can definitely "handle" more players than you'll ever have to store

#

You don't have to worry about that

glad salmon
quick gust
#

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

glad salmon
quick gust
#

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

glad salmon
#

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

quick gust
#

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

glad salmon
#

@unreal monolith is my code guy and has done a great job based on what he's been given so far @quick gust

quick gust
#

that's great

glad salmon
fast osprey
#

but catching up absolutely do not use discord messages in lieu of a database if you need to store and access things programmatically

glad salmon
radiant shuttle
#

my discord commands are dublicated to my main server bot not to other test servers

fast osprey
#

What library are you using?

radiant shuttle
fast osprey
#

Discord isn't a library

radiant shuttle
fast osprey
#

How are you syncing your commands?

radiant shuttle
#
    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

fast osprey
#

You should not be syncing every time your bot starts

radiant shuttle
#

so?

woeful hill
#

You sync when you want discord to know that the commands have changed that they need to know

fast osprey
#

Duplicates happen when you sync the same command both globally and to a guild

radiant shuttle
#

ok and how can i make it synce to keep some commands to my main server and some to global ?

tender bobcat
fast osprey
#

Declare the commands as you want them in code and then sync both globally and to that guild

fast osprey
tender bobcat
fast osprey
#

it is also a library

tender bobcat
#

What defined to be library

#

Such that discord isn't but discord.py is

fast osprey
#

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

radiant shuttle
#

what i should change to this code finally?😂

radiant shuttle
#

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)?

fast osprey
#

Commands are either global or tied to a guild

radiant shuttle
#

so i cant keep some commands for a server and all the others for another main admin server?

fast osprey
#

you can

#

each command has its own declaration

radiant shuttle
#

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

fast osprey
#

because at some point you synced it to both scopes

#

do what I said and it will get fixed

radiant shuttle
#

can you please send me what to change
in the code i send before

fast osprey
#

I'm not going to write code for you. If you don't understand what I recommended, you can ask questions

radiant shuttle
#

ok
so

self.tree.clear_commands(guild=main_guild)  
#

i use this and after maybe comment it?

fast osprey
#

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

radiant shuttle
#

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?

timber dragon
#

do you want the commands to be global? like available in all servers

radiant shuttle
fast osprey
#

Then declare them as such, reload your code, and then sync on both contexts

radiant shuttle
#

Please

fast osprey
#

which part?

radiant shuttle
#

In the main file that you said u have to declare and then sync

fast osprey
radiant shuttle
#

When you say declare them as such

#

Toy mean global and main ?

fast osprey
#

Yeah for each command choose either global or to a guild

#

global is default

radiant shuttle
#

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, ...)
timber dragon
#

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

radiant shuttle
timber dragon
#

most likely

radiant shuttle
# timber dragon 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

timber dragon
#

did you remove the copy_global_to and clear the dups

radiant shuttle
#

yes

timber dragon
#

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
  1. remove current syncs and add above code
  2. restart bot
  3. remove above code and add back previous syncs
  4. restart bot
radiant shuttle
# fast osprey Yeah for each command choose either global or to a guild
@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?

timber dragon
#

yup

radiant shuttle
#

ok this is what i do

radiant shuttle
#
  1. so i delete this for now
  2. i run what you send
  3. restart
  4. i put the following code again
  5. 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})")
timber dragon
#

yes.

radiant shuttle
#

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?
fast osprey
#

why are you clearing commands

#

and is this after you've loaded all commands into the tree?

timber dragon
#

well it doesn't matter now

#

you synced twice to one guild

radiant shuttle
#

when i run this there is no command into the servers

timber dragon
#

nice

radiant shuttle
#

now i will run the previus

#

now the commands are dublicated

radiant shuttle
#

i dont have to clean commands then?

fast osprey
#

no

fast osprey
timber dragon
#

do you still have that copy_global_to...

radiant shuttle
#

i am coocked

radiant shuttle
#

can you please send me the solution
i am stuck for 6-7 hours in this ptoblem

timber dragon
#

wrong message

radiant shuttle
timber dragon
#

read your code

#

remove any copy_global_to, clear_commands, sync from your code and start fresh

radiant shuttle
#

not working..

timber dragon
#

what did you do

radiant shuttle
#

1 i have no copy_global_to
i cleared the commands with the code you send

#

after that i synced with the old code

timber dragon
#

send code

#

!paste

unkempt canyonBOT
#
Pasting large amounts of 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.

radiant shuttle
timber dragon
#

and the cogs?

radiant shuttle
#

i will send only one as an example

radiant shuttle
fast osprey
#

Please, for the third or fourth time

#

stop syncing in setup_hook

fast osprey
#

and stop using clear_commands

radiant shuttle
timber dragon
#

lgtm

#

do any commands show up currently?

radiant shuttle
#

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?

timber dragon
#

no

#

remove that all except loading the cogs

south vault
#

What you building

radiant shuttle
#

so i keep only this

await self.auto_discover_and_load_cogs("cogs")
        await self.auto_discover_and_load_cogs("MainServer")
timber dragon
#

in setup_hook yes

radiant shuttle
#

ok now commandsa re not dublicated but i dont have me mainserver commands only

timber dragon
#

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)
radiant shuttle
#
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

timber dragon
#

not sure why everything is wrapped into try-excepy but sure

radiant shuttle
#

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)

fast osprey
#

dont' sync in on_ready

timber dragon
#

...........................................................

fast osprey
#

man we tell you these things like 5 times and you completely ignore them

timber dragon
#

that's the dumbest thing you've could've done.

radiant shuttle
#

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

timber dragon
#

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

radiant shuttle
#

so if i want to add another command only for main server i have to use the !sync?

timber dragon
#

yes

#

that' will also sync globally, which is not the best thing to do but you can figure that out

radiant shuttle
#

so what else can i do to avoid globally sync and only guild sync

timber dragon
#

maybe add a parameter that can switch between the two

radiant shuttle
#

like !syncmain
! sync global?

timber dragon
#

sure

timber dragon
#

click it

radiant shuttle
#

yes but i only have 2 options main and global i dont need more that he want to say i think

timber dragon
#

sure

#

could always future proof it

radiant shuttle
#
@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>

timber dragon
#

lgtm

radiant shuttle
# timber dragon 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?

timber dragon
#

perfect!

#

could add a "both" option too

#

sync returns the commands too so you could maybe output that amount

radiant shuttle
#

like !syncall

timber dragon
#

i meant more like elif where.lower() == "both": ...

idle laurel
#

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))
timber dragon
#

Try global + restarting your app (ctrl r)

idle laurel
#

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

timber dragon
#

Did you actually restart discord

#

Yeah lol

idle laurel
#

yep working now, miss understood lol

mellow wind
#

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

merry cliff
mellow wind
merry cliff
#

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.

woeful hill
astral sparrow
#

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

fast osprey
#

Is this your code?

astral sparrow
#

yes

fast osprey
#

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

astral sparrow
#

oh shit

#

Didn't know that

fast osprey
#

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

astral sparrow
#

ok!

#

making a consent checker first rq as that is the bigger issue, but i'll get back to you after debugging

fast osprey
#

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

astral sparrow
#

yeah its off 😄

stark ingot
fast osprey
#

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)

astral sparrow
#

This is the full code, now with consent checking

unkempt canyonBOT
astral sparrow
#

the forums still don't get auto replies, i'm really lost here

#

any ideas?

fast osprey
#

Which part is failing? Do you have any debugging in?

#

like knowing if your on_message is firing at all

astral sparrow
#

yeah on message is running, it the on thread create that isn't working

#

Every other channel works, just not forums

fast osprey
#

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

astral sparrow
#

🧵 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'

fast osprey
#

Yeah flatten isn't a thing any more

astral sparrow
#

ohhhhhhhh

fast osprey
#

You can just use the async generator

#

!d discord.TextChannel.history

unkempt canyonBOT
#

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...
astral sparrow
#

works now!

#

thanks for the help

fast osprey
#

Do you have copy rights to that music?

radiant shuttle
#

is there a method to align my text in embed (i am using custom emojis)

#

how can i fix it?

tender bobcat
#

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?

fast osprey
#

well then yes it's against discord tos unless you have copy rights or it's royalty free music

tender bobcat
#

You need to check yourself, I am not a lawyer and not your lawyer

unkempt canyonBOT
#

A simple Python library for easily displaying tabular data in a visually appealing ASCII table format

Released on <t:1742845144:D>.

tender bobcat
# unkempt canyon

Note this would require you to put the whole thing in code lock with no formatting

young dagger
#

The other option, use inline fields

young dagger
sick birch
tender bobcat
#

🥴

#

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)

stark ingot
#

Basically try not to have tabular data in discord

#

Is there a reason that you even need the line X part?

tender bobcat
#

Like:
HHHH
iiii

#

Look at the length difference

whole shoal
#

there is another option to use unicode spaces, but again youll have to guess the width

warped raptor
#

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.

burnt quiver
warped raptor
# burnt quiver 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

warped raptor
deep marsh
radiant shuttle
#

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

whole shoal
radiant shuttle
#
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"

whole shoal
radiant shuttle
#

yes

#

it counte the / commands of the server (of my bot)

whole shoal
#

i think you could use appcommands.extras to store the category for each command

radiant shuttle
#

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

whole shoal
#

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
radiant shuttle
whole shoal
radiant shuttle
#

i have to add one line to each cog? like i did before right?

whole shoal
radiant shuttle
#

each cog is 1 command

whole shoal
# radiant shuttle 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

radiant shuttle
#

let me try

#

thanks you dude worked

whole shoal
vapid parcel
#

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

stark ingot
#

I don't think they count the same things.

vapid parcel
#

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.

vapid parcel
stark ingot
vapid parcel
#

Okay, still a little confused as I dont allow user install?

#

I read some of it

#

From what I read its a cache issue

stark ingot
#

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.

vapid parcel
#

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?

stark ingot
#

It is not guaranteed that all your installs have the bot scope, I think

vapid parcel
#

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 😅

stark ingot
#

Yeah, I would just pick one to base your stats on.

vapid parcel
#

Yeah.

mild token
#

have discord removed the ability to remove slash commands? from app directly

timber dragon
#

"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?

full lily
cosmic elk
#

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...

vapid parcel
#

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

muted sand
muted sand
mild token
#

how can i configure logging with bot.start()? i want to pass my log handler i am using discord.py

slate swan
#

hey

#

I'm looking to host my discord bot somewhere, can anyone help me please

quick gust
#

!hosting

unkempt canyonBOT
#
Discord Bot 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.

woeful hill
#

!d discord.utils.setup_logging

unkempt canyonBOT
#

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`...
woeful hill
#

@mild token ^

tender bobcat
subtle crypt
#

!hosting

unkempt canyonBOT
#
Discord Bot 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.

timber dragon
#

Nice consistency discord

#

Oh mention vs not that makes sense

burnt quiver
#

wait huh

#

oh are you on mobile

tacit laurel
#

!hosting

topaz stratus
#

the other way is discord number formatting and putting things that will break the formatting on a new line

rugged shadow
#

i mean its cool

#

but practically useless unless you have some specific need for them

tender bobcat
#

Why is it useful?

fast osprey
#

What the heck does "multiple bots in one" even mean

#

One what

finite salmon
#

Why not just run them separately why even use threads

woeful hill
#

me when im too lazy to write 2 commands

jaunty cape
#

Thanks, my brain has just short-circuited

tender bobcat
#

music bot shouldn't have permission to delete message however

fast osprey
#

Pretty sure what you're describing is literally rate limit evasion

fast osprey
#

That's not a good thing

#

Should probably stop doing that before discord terminates your bots and/or your account

fast osprey
#

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.

zinc current
#

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

burnt quiver
celest pelican
zinc current
celest pelican
zinc current
burnt quiver
#

Seems like it focuses more on examples and explanation than specifics which is very nice

burnt quiver
#

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

fast osprey
#

FWIW this guide is not endorsed by the library maintainers. Use at your own discretion, I personally have qualms with things in it

timber dragon
#

It's all open source for PRs and such
Or ping the maintainer Shrug

wise mica
#

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

fast osprey
#

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

tender bobcat
fast osprey
#

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

wise mica
wise mica
fast osprey
#

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

wise mica
#

or SQL lite, ig ive never used pure SQL

fast osprey
#

People often fall into the trap of using mongo because it's "easy" and then later deeply regret it

wise mica
#

but all my data that i intend to have be changed is handled already by mongo

wise mica
#

yea i kinda did too, but I have learnt how to use it now

fast osprey
#

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

wise mica
fast osprey
#

You can cache it in memory still

wise mica
#

but mongo has been fine for me, everything i wanted to do with changing data i have solved, i think

fast osprey
#

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

wise mica
#

through a dictionary 😅

fast osprey
#

That's not a database just because you call it that. Nobody is setting rules here

#

Lazy as hell ragebait

timber dragon
#

Lmaooo

woeful hill
#

Is that the same person that did the on_ready syncing ragebait before

#

Too much time on your hands

quick gust
#

no its not

jaunty cape
#

Why is it always this one person doing the most stupid shit

fast osprey
#

Are you asking for help or just starting shit

#

none of your code even has a slash command

tender bobcat
young dagger
#

What is difference between discord.UserFlags.spammer and discord.PublicUserFlags.spammer?

young dagger
tender bobcat
#

Apparently stating fact is not allowed

patent hull
#

lol ?

#

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

celest pelican
#

!timeout 1346773577575301152 1h investigating

#

!mute 1346773577575301152 1h investigating

unkempt canyonBOT
#

: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.

patent hull
#

Thanks, and sorry for pinging

potent fox
#

!tempban 1346773577575301152 14D The messages you sent and being rude to other users of this server is unacceptable.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @astral mural until <t:1753998034:f> (14 days).

pearl bough
verbal fable
#

Insane beef in python discord 💀

burnt quiver
#

:(

verbal fable
#

I added a couple new commands and it simply doesnt update

burnt quiver
#

Uh did you sync it

verbal fable
#

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?

full lily
#

I think ideally it should be its own command, and shouldn't happen when the bot is started

verbal fable
#
# --- 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

full lily
#

and what is tree?

verbal fable
#

tree is my command tree

#

It holds "@tree.command"s

full lily
#

can i see the definition

#

And the command also

#

I assume there is no error

verbal fable
#
# --- /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

full lily
#

did you just do tree = bot.tree?

verbal fable
#

Nope, I made an object asigned to tree like
tree = app_commands.CommandTree(client)

full lily
#

hm

verbal fable
#

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

full lily
#

I would definitely move the sync outside of on_ready at some point

#

since that can fire randomly. You might get rate limited

full lily
#

just for troubleshooting. Not to say it's not valid

verbal fable
#

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

fast osprey
#

Make sure you're always refreshing your discord client, too

full lily
#

also that call will return the commands that got synced. So I would print that and inspect it

verbal fable
#

WTF

#

Appereantly now the commands are there

full lily
#

👍

verbal fable
#

Love this app 🙂

full lily
#

Just had to update the client then I guess

verbal fable
#

I got no idea why this works this way but not gonna question it

full lily
#

I mean think about how it would be if it were fetching commands all the time

#

It wouldn't make sense

fast osprey
#

Given how rarely commands change these are heavily cached

verbal fable
#

valid

#

dang Im stupid for this

#

Going back to my good old C

stark ingot
#

Does discord.py remove all commands and readd them when you sync?

#

Or does it use upsert?

unkempt canyonBOT
#

discord/app_commands/tree.py line 1129

data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload)```
timber dragon
young dagger
#

What would you call a function that monitors someone's activity/messages in a server?

fast osprey
#

steve

#

Or creepy

young dagger
#

I guess /track @user and /untrack @user

fast osprey
#

Probably worth reading over the tos and dev policy

quick gust
#

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

fast osprey
#

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

young dagger
young dagger
quick gust
fast osprey
#

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.

young dagger
quick gust
#

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

fast osprey
#

I'm not referring to that clause

#
  1. Do not enable your Application to bypass or circumvent Discord’s privacy, safety, and/or security features.
quick gust
#

Yeah but that's also a clause in the developer policy

#

The clauses aren't independent

fast osprey
#

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

young dagger
fast osprey
#

How does some random article pertain to the developer policy

young dagger
fast osprey
#

Again. How does this article change the wording of an official document

fast osprey
#

Discord inconsistently enforced their own tos all the time. That doesn't change whether or not that thing is compliant with the tos

quick gust
#

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...

young dagger
fast osprey
#

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

quick gust
#

as long as Discord does not define what a privacy feature is, its "your word against my word" and it literally does not matter

fast osprey
#

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

quick gust
#

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

fast osprey
#

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?

quick gust
#

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

fast osprey
#

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

quick gust
#

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

fast osprey
#

So it is a privacy feature

celest pelican
#

I guess the question is: Does copying of some messages to a hidden moderation channel constitute bypassing of this feature.

quick gust
#

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

fast osprey
#

This isn't a legally binding document. It's a policy.

#

There is no courts, it's up to discord to selectively enforce

fast osprey
quick gust
fast osprey
#

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

celest pelican
fast osprey
#

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)

stark ingot
fast osprey
#

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

wise mica
#

but realistically, a bot preserving your message is no different from a user just screenshotting your message and storing that

fast osprey
#

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

stark ingot
fast osprey
#

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

bleak sierra
#

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?

fast osprey
#

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

bleak sierra
#

let me ask you an analogous question:
would screenshotting this convo, moments before you delete a silly message, be privacy invasion?

fast osprey
#

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

bleak sierra
#

its a question you cant even answer?

fast osprey
#

It's a question that's irrelevant to the conversation

jaunty cape
bleak sierra
#

analogies are used to expose or convey relevance and such

fast osprey
#

"privacy invasion" wasn't even a term anyone used

bleak sierra
#

this is relevant cause it is privacy

fast osprey
#

so no, I don't think it's a "privacy invasion" but that term doesn't mean anything

bleak sierra
#

sorry, breach of privacy"

fast osprey
#

same thing

bleak sierra
#

go argue with your parents lol

fast osprey
#

The point being made was that it's a circumvention of a supported privacy feature

bleak sierra
#

your expectations are outadated at best, most servers log messages

#

it is expected

fast osprey
#

and if you read the conversation, bots doing something is not remotely a signal that it's ethical or compliant with the policy

bleak sierra
#

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?

fast osprey
bleak sierra
#

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

fast osprey
#

That is not a reasonable retention period by any sane evaluation

bleak sierra
#

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

fast osprey
#

They do in their developer policy. They just neglect to actually enforce anything that doesn't actively impact their bottom line

bleak sierra
#

Do not enable your Application to bypass or circumvent Discord’s privacy, safety, and/or security features.

fast osprey
#

You can re-read the conversation on whether or not the ability to have a message deleted from being read is a privacy feature

bleak sierra
#

what exactly does this mean?

#

you seem to just love tos and hate bots

fast osprey
#

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

bleak sierra
#

deleting a message in my opiniono is not related to privacy except in that it should not be viewed as a form of privacy

fast osprey
#

That's an opinion you are welcome to but one I vehemently disagree with (and privacy frameworks like GDPR would as well)

bleak sierra
#

entering any server, you agree to their rules, and that includes the moderation

fast osprey
#

If a server provided a rule stating the conditions under which my messages would be retained, sure

#

people however don't do that

bleak sierra
#

you cant assume privacy

#

thats your issue

fast osprey
#

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

bleak sierra
#

privacy policy, page 6

#

even discord has a legal obligation to retain deleted data in some cases

fast osprey
#

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

bleak sierra
#

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)

fast osprey
#

Again. You can do that without logging identifiable messages forever. This isn't an either/or and you can cut the false dichotomies

bleak sierra
#

you cant assume privacy where it isnt implied explicitly

stark ingot
#

Pretty sure most logging bots dont retain messages forever

fast osprey
#

Again, I am not assuming anything. I have identified a privacy feature and bots circumventing that privacy feature

bleak sierra
fast osprey
bleak sierra
#

and again, sending to a channel isnt permanent retention

stark ingot
#

^ the bot is not storing data it sends to a channel

fast osprey
#

How do you define permanent

bleak sierra
#

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)

fast osprey
#

And that is augmenting what the native delete message feature does without my consent

bleak sierra
#

after its sent to that channel, it isnt ever in the bots process again

fast osprey
#

like you keep talking around the point that this is literally what the dev policy says not to do

bleak sierra
#

deleting a message ~ privacy
channels ~ permanent retention
moderation = tracking members + their content

#

simple as day

#

"we dont control them or waht information they collect"

fast osprey
#

need to follow all policies that apply to them

bleak sierra
#

keep reading ignoranus

fast osprey
#

Which later part negates that statement

bleak sierra
#

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

fast osprey
#

Not if it violates policy

bleak sierra
#

what policy?

bleak sierra
#

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

fast osprey
#

I do not know you're right because you refuse to actually address that point and talk around it

bleak sierra
#

goodbye, enjoy argueing with the next person that steps on your bridge

fast osprey
#

👋

bleak sierra
#

have a noce day pirate

fast osprey
#

You have a great day too!

tender bobcat
#

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.

fast osprey
#

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

stark ingot
#

Please enlighten?

fast osprey
#
  • 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
stark ingot
#
  1. Is normal message caching too long of a retention period for you?
  2. So basically just require an extra click for moderators or limit the ability to moderate continuous troublemakers
  3. Sure, but the only way that that system could not be abused is if you ban the user who requests this
fast osprey
#
  1. 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"
  2. 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.
  3. 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.
tender bobcat
#

pithink 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

stark ingot
#
  1. I mean logging bots do not store message content, they resend it to discord and do not maintain a link to that message.
  2. How do you know if action needs to be taken on a offense that is not committed in the message content. IE spam.
  3. 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
fast osprey
#
  • 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 message does 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 not technically being stored by them. What this period is, that's up for debate but is a good faith discussion to have when it's not indefinite
  • That's a good point, but could be implemented as another check. X user sent Y <similar/same> messages in this time period is 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.
tender bobcat
#

Have you implemented one that you consider more ethical?

fast osprey
#

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

bleak sierra
#

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?

tender bobcat
tender bobcat
bleak sierra
#

guess ill have to actually read the damn thing eh

tender bobcat
#

yes you actually do need to read it

bleak sierra
#

sad that i need a lawyer just to run a discord bot these days

tender bobcat
#

Well, basically no one would care if you are small enough and/or not doing something very weird

bleak sierra
#

oh im small alright 😉

tender bobcat
#

I mean the scale of operation of the discord bot

bleak sierra
#

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

fast osprey
#

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

bleak sierra
#

i skim through it just like you

fast osprey
#

I have read it extensively

bleak sierra
#

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

tender bobcat
#

I mean that clause is realistically very ambigious as they usually are

fast osprey
#

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

bleak sierra
#

if you use my bot, you agree to the policy i set out. its that simple

fast osprey
#

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

bleak sierra
#

discords policy? which is what exactly (pertaining to bots)

#

the part where they state bots are 3rd parties and they dont interfere with them?

fast osprey
#

The clause of the developer policy I have referenced multiple times but we don't need to go over that again

tender bobcat
fast osprey
#

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

tender bobcat
#

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.

fast osprey
#

Otherwise good luck exhaustively going through the discord TOS and ensuring there is a equivalent clause in the SP's TOS lol

tender bobcat
#

I mean one that comply with discord requirement
such as the service that just doesn't log anything

fast osprey
#

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

bleak sierra
fast osprey
#

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

tender bobcat
#

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

fast osprey
#

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

bleak sierra
#

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

tender bobcat
fast osprey
#

again, logging isn't the only term

#

that is not the only thing they could do

tender bobcat
#

What can they do?

#

oh yep, forgot to add, they doesn't share it to third party

fast osprey
#

share with third party, or even nebulously to use that data "for no other purpose (including their own)"

bleak sierra
#

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

fast osprey
#

We can both be right

#

Again. Discord is not bound to enforce their policy

tender bobcat
fast osprey
#

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

tender bobcat
#

again no log, therefore if they took the data it mean they log the data

fast osprey
#

well "log" is pretty vague here too

bleak sierra
#

wait wait wait

tender bobcat
#

Any mean of storing the data after returning the result in retrieveable way

bleak sierra
#

i cant use discord to train an ai?

fast osprey
#

If you hash it and use it to feed a model, is that logging?

bleak sierra
#

not if you cant get that data back no

fast osprey
#

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

tender bobcat
bleak sierra
#

arguable if it needs to be 1-1 replication of the data but it wouldnt be the same data, not likely anyways

fast osprey
#

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

tender bobcat
bleak sierra
#

my bot is a llm, like gpt

#

your messages train it

#

therefore its within scope

#

lol

tender bobcat
#

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)

fast osprey
#

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

tender bobcat
#

This was exactly for the purpose you stated

fast osprey
#

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

tender bobcat
#

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

fast osprey
#

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? shrug

tender bobcat
#

I would say expressly directs you and provide us proof suggest it is not

stark ingot
#

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

fast osprey
#

Dang that's pretty solid

tender bobcat
#

Nice

radiant shuttle
#

after 1-2 minutes of not using my ui buttons i have a message that This interaction failed
can i fix that?

radiant shuttle
burnt quiver
#

not too sure what your use case is here, you'd have to be more specific

radiant shuttle
#

eg i have to choose button 1 and button 2
after 60 secodns of not choosing anything then bot will autochoose for you

burnt quiver
#

sure

fervent juniper
#

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

fast osprey
#

You can provide them here using the paste service

#

!paste

unkempt canyonBOT
#
Pasting large amounts of 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.

lime meadow
#

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

fast osprey
#

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

lime meadow
#

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)

tender bobcat
#

please show the code

#

so we can at least explain to you what happen

fast osprey
#

It doesn't recommend that cogs are loaded before bot.run.

#

You need to start the event loop before you do any of that

lime meadow
# tender bobcat please show the code

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

fast osprey
#

Can you show how you create/load this cog?

tender bobcat
#

!d discord.ext.tasks.Loop.start

unkempt canyonBOT
lime meadow
# fast osprey Can you show how you create/load this cog?

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)

fast osprey
#

You should do this in your bot's setup_hook, not a separate aysncio.run

lime meadow
#

Thanks, it worked! I thought setup_hook was the same as loading things manually

fast osprey
#

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

lime meadow
#

Makes sense

muted sand
fervent juniper
muted sand
burnt quiver
#

Why not yet send it here lol

fervent juniper
burnt quiver
#

Yes, with?

past totem
compact juniper
#

I wanna create a role ping for rare pokemon spawn in my discord pokemon catch detection bot. Will this be hard to do?

fast osprey
#

"Hard" is entirely relative

compact juniper
#

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

fast osprey
#

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

compact juniper
#

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

fast osprey
#

That's not at all what I said but sure

timber dragon
compact juniper
fast osprey
#

I'm not referring to images. "spawn" is something you're just guessing at, they can change how their bot behaves at any point

robust rune
#

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

fast osprey
#

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)

robust rune
#

Do u have smth like a repo or a yt video?

fast osprey
#

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

robust rune
#

I mean in the repo and documentation there are examples of both i mentiones

fast osprey
#

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

robust rune
#

have u made a dc bot i could check? im checking the server Python Bot to give me some ideas

#

or a tuto

fast osprey
#

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

robust rune
#

Ok i see, thanks for ur help, i rlly appreciate it

fast osprey
#

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

robust rune
#

Also quick question i just remembered, what are cogs and they're use? i dont understand them

fast osprey
#

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

robust rune
#

wut?

fast osprey
#

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

robust rune
fast osprey
#

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

robust rune
#

like a tree with different leaves and the cogs are the branches?

fast osprey
#

I suppose that's one way of looking at it yeah

robust rune
#

lol its what came to my mind

fast osprey
#

it just lets you pick groupings of stuff you would add into your bot, and you can add/remove that stuff together

robust rune
#

ahhh i see

fast osprey
#

The most common things are commands, tasks, and listeners but it could really be any arbitrary stuff you'd enable on the bot

robust rune
#

kay

#

thxs again and if i need ur help can i ping u? (apart from asking here)

fast osprey
#

Yeah I don't mind pings, lots of folks around can help too

compact juniper
#

I guess for autocatcher purposes

fast osprey
stark ingot
compact juniper
#

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

fast osprey
#

If they want you to build off their bot, they'd provide you a reasonable API to use

stark ingot
#

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.

compact juniper
#

He said extra work for little to no gain

fast osprey
#

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

compact juniper
#

Yea the spawns change periodically i assume

#

So now i guess ill be looking into autocatching functions? Idk

wise mica
compact juniper
wise mica
#

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

compact juniper
#

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

compact juniper
wise mica
#

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

wise mica
#

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

compact juniper
compact juniper
wise mica
compact juniper
wise mica
#

you could just ask them if you havent already too

compact juniper
#

Yea those guys generally dont like to share their code haha

#

Guess ill have to do some google searching

wise mica
compact juniper
#

For p2

wise mica
#

No wonder that bot is full of AC now

compact juniper
#

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

stark ingot
#

This isn't a selfbot right....

compact juniper
#

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

compact juniper
vocal kayak
stark ingot
#

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.

stark ingot
compact juniper
slate swan
#

HELLOOOOOOOO

#

Is There Anyone?

young dagger
#

setdefault vs defaultdict? Which one is better to use with a asyncio lock?

shrewd apex
young dagger
#

To avoid race conditions on a specific key

timber dragon
#

get defaults to None fwiw

leaden cypress
#

how do i make a discord bot in python

fast osprey
#

Well for starters, how much python do you know?

cloud dawn
#

Me: docker compose up

rotund turret
leaden cypress
#

@fast osprey well i know a lot(advanced) like databases data science with matplotlib and tkinter, flask

fast osprey
#

But how much core python do you know? Do you know how to make classes/general OOP? Do you know how asyncio works?

open cobalt
#

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?

fast osprey
#

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

wheat summit
#

Hello! Why is it not counting my "send_message" here?

burnt quiver
#

pretty sure it's a pycharm bug, you code should work fine

wheat summit
#

Let me see.

wheat summit
burnt quiver
#

you gotta sync it then restart discoerd

wheat summit
#

Ohh right I forgot lol.

wheat summit
fast osprey
#

send_message isn't a method of Interaction

#

It's a method of the InteractionResponse and it can only be used once

wheat summit
fast osprey
#

By "it won't work", do you have an error?

wheat summit
#

No.