#discord-bots

1 messages ยท Page 808 of 1

pliant gulch
#

I doubt I'll be anywhere close to done soon

#

Give or take a few weeks or a month or two depending on how motivated I am

slim ibex
#

Id love to contribute but Iโ€™m not much of a Python dev anymore

ebon island
#

So it isn't presently in usable form?

pliant gulch
#

Currently only a few models are semi-implemented, the only thing COMPLETELY usable is the backend stuff, caching, dispatching, event listeners, one-time events, event collectors, waiting for events, intents, gateway handling, member chunking, etc

velvet tinsel
slim ibex
#

๐Ÿ—ฟ

pliant gulch
#

It's in a form now where it's enough for anyone of a certain skill level to extend the wrapper itself

#

But it's not very good for new-users right now?

#

Or users who want a lot of syntactic sugars

slim ibex
#

it seems like your wrapper is for more experience devs

velvet tinsel
pliant gulch
#

docs are also a hurdle you need to jump

ebon island
#

I'm an advanced python user, if it will improve time to implementation for the menu system I already want to build I'm willing to learn

pliant gulch
#

As I don't have much documented

slim ibex
#

but making it better for beginners would mean very good docs

pliant gulch
#

You'd be reading the source code to do your stuff

slim ibex
honest vessel
#

disnake.ButtonStyle cant set custom hex?

velvet tinsel
#

Is there a discord wrapper for C#?

slim ibex
#

yea

velvet tinsel
slim ibex
#

DSharp+ or something

ebon island
#

that's fine if I can additionally ask you the occasional question via DM? If that's an acceptable thing I'd be willing to give it a try

velvet tinsel
pliant gulch
#

My DMs are off right now, but if you check the repo you will see the discord invite link to my Rin support server

#

There I recommend joining, as I post updates, talk with everyone for suggestions, etc

#

I also do some sneak peeks

ebon island
#

I don't see the link in the repo, where is it?

pliant gulch
#

I would say for now, if you plan on using the wrapper I wouldn't do any serious project. As the wrapper itself right now is in pre-alpha and is meant to be used bleeding edge

slim ibex
pliant gulch
#

The discord badge

ebon island
#

Got it ๐Ÿ™‚ Never seen that in a git repo

slim ibex
#

I never knew how to do badges ๐Ÿ—ฟ

pliant gulch
#

I had toxickids make a PR for me ๐Ÿ˜”

dense coral
#
 member = ctx.author
  with open("users.json", "r") as f:
    data = json.load(f)
  data[str(member.id)] = {}
  data[str(member.id)]["coins"] = 0
  data[str(member.id)]["inventory"] = []
  with open("users.json", "w") as f:
    json.dump(data, f, indent=4)

Can anyone help me, I did import json

ebon island
#

So if I'm understanding correctly, this is intended to be a wrapper for the entirety of dpy?

pliant gulch
#

The only thing that I plan for the wrapper to have in common with discord.py is the native API part, I don't plan on adding chat command extensions, instead keep the wrapper fully native with discord's API, also adding a few syntactic sugars here and there

ebon island
#

Since I see in client.py example you're handling starting the bot with a key I'd assume the intent is handling all of the methods/calls that dpy does, is that a correct assumption?

pliant gulch
compact ruin
#

Uh so im using digital ocean for the first time and ive been hit with a problemo

ebon island
#

Very cool! I'm excited to see it as it grows, perhaps when it reaches some maturity I'll take the time to rebuild all my methods on your wrapper ๐Ÿ™‚

compact ruin
#

Ive imported tk but it still wont work....

#

Anyone know why...?

ebon island
#

looks like you need to install tkinter

compact ruin
slim ibex
#

Tkinter in a discord bot?

wispy spade
#

Not sure why you would need Tk for a bot tho

compact ruin
#

on my local host it was going fine

#

but on remote host (im using digital ocean)

#

that message keeps poppin up

#

and ive never used Digital ocean so i dont wanna assume anythin i dont know around it lmao

#

nvm fixed it

slate swan
#

guys got any good servers for js or nodejs?

#

servers that are big like this one

#

well at least 1/10th as big

compact ruin
#

Uh okay so now its running

#

how do i keep it running

#

If anyone knows could use the help. I normally use Repl it and im new to digitalocean so yh

slate swan
#

@compact ruininteresting

#

ur username is sultan

compact ruin
compact ruin
slate swan
#

Are you a Muslim by any chance?

compact ruin
slate swan
#

hey guyss

        def check(message):
            print(message)
            return message.author.id == ctx.author.id

        try:
            message = await client.wait_for('message', timeout=15.0, check=check)```

Idk why its not working, when i print the object it shows the contents of the object like expected, but i cant grab it for some reason, some bullcrap about "typeerror: cant unpack"
slate swan
compact ruin
sick birch
honest vessel
#

is this alot ?

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 3803 xxx       20   0  814956 111612  12580 S  2.3 10.9   2:51.04 python3

#
Tasks: 102 total,   1 running, 101 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.3 us,  0.3 sy,  0.0 ni, 95.0 id,  0.0 wa,  0.0 hi,  0.3 si,  0.0 st
KiB Mem :  1020244 total,   472848 free,   178840 used,   368556 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   682936 avail Mem
#

its a discord with 7 users ๐Ÿ˜„

#

but it has 3databases, and runs 2 tasks

slate swan
#

Is it possible to make sure that when a person deletes a photo or file, on_message_delete contains the name of the file, like this

slate swan
#

lemme show the whole thing

final iron
#

!d discord.Attachment.filename

unkempt canyonBOT
slate swan
#

Okay

compact ruin
#

Can anyone help me with starting a python file on DigitalOcean

#

im using PM2 but it wont work

final iron
#

If they're long you can use:

#

!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 floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

slate swan
#

Why doesn't anyone ever answer me NOOO

final iron
#

What do you expect

sick birch
slate swan
#

based

final iron
#

To answer your question, just use a dictionary

slate swan
#

hmm

#

yeah

#

dictionary

sick birch
#

Open a new one and let me know

final iron
#

!e

dict_ = {"a": "simple dict"}
print(dict_["a"])
unkempt canyonBOT
#

@final iron :white_check_mark: Your eval job has completed with return code 0.

simple dict
sick birch
#

a dict will only make things harder

slate swan
#

well, tuple sounds good but i'd need to grasp it a bit better

final iron
#

How would a dict make things harder?

sick birch
#

Since he needs to get a random question, then the corresponding answer

#

Would be easier to have a list of tuples

slate swan
#

^

final iron
sick birch
#
questionsAndAnswers = [
  ("question 1", "answer 1"),
  ("question 2", "answer 2"),
]
#

Then to get a q & a, just do:

questionsAndAnswers = [
  ("question 1", "answer 1"),
  ("question 2", "answer 2"),
]

question, answer = random.choice(questionsAndAnswers)
#

instead of messing with indexes of dicts and whatnot

slate swan
#

ooh i should try this

#

ill update on if this works

#

brb

sick birch
#

Feel free to ask any questions about it

slate swan
#

oh how do i append tho

sick birch
kindred drum
#

How would I give a user permission to a channel upon a command, e.g. !add <user>

sick birch
#

Then give them that role when they run the command

#

Or do you mean they should just be able to view it?

kindred drum
#

able to view that one channel and type in it

#

overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
payload.member: discord.PermissionOverwrite(read_messages=True)} this gives a user access when its created with
create_channel = await guild.create_text_channel("Middleman-Ticket", overwrites=overwrites)

slate swan
#

just a question, im using motor client, so i don't have to import pymongo[srv] right

flat solstice
#

anyone got any suggestions on how I could implement a reminders system to my bot. I was thinking of having a remind <date/time> <message> command which logs ctx.author.id, ctx.guild.id, date/time and message to my database which I can setup (mostly) without issues (haven't made it yet) but I'm not sure how to make the bot actually send the reminder, I was thinking maybe use a task set to run every second or something but that seems excessive and expensive on my bot if it's making a database call every second and I also thought about just making the remind command sleep until the provided time but then how do i deal with the bot restarting. I'm mostly just wondering how y'all suggest I go about making the set send the reminders

sick birch
#
tasks.loop(time=..., ...)
...
final iron
#

How does the python bot do it

#

!src remindmef

unkempt canyonBOT
#
Bad argument

Unable to convert 'remindmef' to valid command, tag, or Cog.

final iron
#

!src remindme

unkempt canyonBOT
#
Command: remind

Commands for managing your reminders.

Source Code
slate swan
#
def automate():
    payload = {
        "content":"SA",
        "message_reference":{
                "guild_id": "903733750062547025",
                "channel_id": "904437095207170068",
                "message_id": "939988992152203334"}}

    header = {'authorization': token}

    r = requests.post(f"https://discord.com/api/v9/channels/{channelId}/messages",data=payload, headers=header)
    print(json.loads(r.text))

automate()```


hey does anyone know how to reply to a message with requests? i try this and i get the error

`{'code': 50035, 'errors': {'message_reference': {'_errors': [{'code': 'MODEL_TYPE_CONVERT', 'message': 'Only dictionaries may be used in a ModelType'}]}}, 'message': 'Invalid Form Body'}`
trim storm
#

how do you get user game activity

#

like, i want the bot to get the name of the game a user is playing if they're playing a game and its connected with discord activity

kindred drum
#

AttributeError: 'User' object has no attribute 'guild'
guild = member.guild

#

anyone got a quick fix

flat solstice
# sick birch https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.task...

okay thanks for showing me that as i wasn't aware i could pass time into the task, next question; since I'm storing the time in the db how do i then pass that to the loop? since i access the db data via await and await needs to be inside of a function to work but I can't put the await inside of the task since it nedds to have the data to give to the task function (if that makes sense)

sick birch
#

I see what you're asking

#

Let me see how @unkempt canyon does it

#

Hm yeah, that's actually a very good question

#

I'm not sure how you would do that ๐Ÿค”

flat solstice
#

deadpoolshocked if a python helper doesn't know then it must be complicated

sick birch
sick birch
sick birch
#

Not as a "use coroutines outside of async"

#

I'm looking at reminders.py for @unkempt canyon and it's not immediately obvious what's alerting it that it's time for a reminder to be sent

flat solstice
#

also different thing, can i type hint datetime in commands?

sick birch
#

Unfortunately no

#

Pretty sure there was a tag on the official discord.py server for a custom time converter, worth checking it out

slim ibex
#

You can type hint a custom time converter doh

slate swan
slim ibex
#

worked for me

flat solstice
flat solstice
slate swan
sick birch
slate swan
slate swan
#

Or make a custom time converter, yes

flat solstice
#

yeah I've just been checking out dpy's tags on time converters

flat solstice
slate swan
# flat solstice guess learning apscheduler is my next big task

It's not that hard for simple use like this one.. ```py
from apscheduler.schedulers.background import BackgroundScheduler

scheduler = BackgroundScheduler() # Attach this instance to your bot as a botvar

Now to add and remove jobs, just do like ```py
def remind_user():
    send_message_to_user_about_reminder_time_completion()

def command_to_create_reminder(time):
    bot.scheduler.add_job(remind_user, 'interval', seconds=time, id="some_unique_id")

You can also create a cancel command like ```py
def command_to_cancel_existing_reminder():
bot.scheduler_remove_job("same_unique_id_which_you_used_while_adding_job")

Ofc you can do more customizations like storing jobs in cache or db, loading and unloading them on startup and cleanup, and more... It's the most basic usage you need to do to create a reminder command
flat solstice
dry junco
#

a wait does somone have alr made currency script thingy ?

#

or economy idk what the name is

#

and idk am i allowed to ask that

sick birch
#

Sure, you can ask help on how to make a currency functionality for your bot

dry junco
sick birch
#

Relational:

  • MySQL
  • Sqlite
  • Postgres
    NoSQL:
  • mongodb
sick birch
#

Do some research and pick out which one you want. As a starting place, sqlite is probably the easiest to deal with but the most limiting. Postgres is a favourite of a lot of people, it's quite robust but at the cost of not being as easy to set up

sick birch
#

If you're self hosting none of them cost anything

dry junco
#

o

sick birch
#

It should be bundled in with a VPS if you go the non-AWS route

#

If you go with AWS, they have a seperate service for databases

dry junco
#

o alr

steel void
#

how to use a command inside of a slash command?
im using pycord
Basically, I call blackjack with /blackjack but now I need to figure out a way to allow the user to hit or stand

torn sail
#

Maybe buttons on a message the bot responds with to show the starting cards?

steel void
#

buttons are a pain for me right now

#

how would i go about doing it with a on message event or something

sick birch
#

Would be a problem considering bots don't get message intents starting april

#

Buttons would be your best bet

#

One for hit, one for stand

torn sail
#

Yep

plain glacier
#

TypeError: can only concatenate str (not "Guild") to str what does this error mean?

slim ibex
#

show code and what line raises that

plain glacier
slim ibex
#

there is prolly something that returns an integer there (message.guild, message.author, message) prolly

#

you want to make it a string

#

and pls use f strings

#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

sick birch
#

You can't add together (if you can say that) a guild object and a string

#

You can only add strings to other strings

slim ibex
#

^

sick birch
#

iirc str(guild) will return the guild name

#

alternatively, you can do guild.name if you like that better

#

and consider using f-strings for your purposes here

plain glacier
#

it says guild is not defined

#

oop nvm i got it

flat solstice
# slate swan It's not that hard for simple use like this one.. ```py from apscheduler.schedul...

Hi, just checking in with a update on what I've done so far so i can check I'm on the right track```py
from apscheduler.schedulers.background import BackgroundScheduler

scheduler = BackgroundScheduler(bot)Is what I have on my main file, and this is what I have in my new reminder.py filepy
import asyncio
import logging
import typing
import discord

from discord.ext import commands
from discord.utils import get
from utils import checks
from datetime import datetime, timedelta
from typing import Optional, Union
from classes.converters import DateTime

log = logging.getLogger(name)

class Reminder(commands.Cog):
def init(self, bot):
self.bot = bot

def remind_user(self, member):
    #send_message_to_user_about_reminder_time_completion()
    user = await self.bot.get_member_guild(member.id, member.guild.id)
    reminders = await self.bot.get_reminders(member.id, member.guild.id)
    embed = discord.Embed(title = "Here's your reminder!", description = "{reminders[5]}", timestamp = reminders[6])
    if user[9] == True:
        await member.send(embed = embed)
    else:
        ctx_channel = await self.bot.fetch_channel(reminders[7])
        await ctx_channel.send(embed = embed)

def create_reminder(self, time):
    self.bot.scheduler.add_job(remind_user, 'interval', seconds=time, id="some_unique_id")

def cancel_reminder(self,):
    self.bot.scheduler_remove_job("same_unique_id_which_you_used_while_adding_job")

@commands.command(description = "Create a reminder.", usage = "send <server ID> <message>")
async def remind(self, ctx, time: DateTime, *, message: str):
    await ctx.reply(f"Okay {ctx.author}, I'll remind you about '{message}' in {time}")
    await self.create_reminder(time)

def setup(bot):
bot.add_cog(Reminder(bot))```I don't think I'm doing remind_user correctly as I'm getting "await" allowed only within async function

slim ibex
#

async def remind_user

flat solstice
#

Facepalm scream that makes more sense

slim ibex
#

๐Ÿ’€

flat solstice
#

should my other functions also be async?

slim ibex
#

dont have to be

#

they should be though if'

#

they are api calls (in this case commands and listeners)

slate swan
#

Im trying to import slash commands but uh

from discord_slash import SlashCommand, SlashContext
from discord_slash.utils.manage_commands import create_choice, create_option```

says discord_slash doesnt exist
slim ibex
#

oh no, not discord slash

plain glacier
#

it works but not in the way i want it to work ๐Ÿ˜…

slim ibex
#

!f-strings

unkempt canyonBOT
#

Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.

>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."

Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.

plain glacier
#

oh

#

do i have to add {} ?

slim ibex
#

it should be
f"{message.guild} {message.channel} {message.author} {message}"

plain glacier
#

yeah i figured lmaoo thanks

#

imma try it rq

slate swan
#

plus its not really my fault they making it mandatory anyways

slim ibex
#

use a fork like disnake that has slash commands and tons of extra features built in

slate swan
#

id like to actually learn how to create slash commands first lmao

#

so how do i import?

slim ibex
#

yeah u can do it with disnake

#

it seems like you might not have it installed

slate swan
#

i dont get it?

slim ibex
#

no

#

whjat

slate swan
#

im just tryna import the module i need for slash commnds

slim ibex
#

yeah do you have discord_slash installed

slate swan
#

how come it says module not found then?

#

cuz i dont have disnake????

slim ibex
#

this has nothing to do with disnake, i just brought it up because its a better alternative

slate swan
#

oh okay

#

ill try it after i can figure this bit out

#

why is it saying module not found for me?

#

from discord_slash import SlashCommand, SlashContext ModuleNotFoundError: No module named 'discord_slash'

slim ibex
#

prolly isn't installed as i said

#

pip install discord-py-slash-command in your terminal

#

pretty sure thats the install

slate swan
#

ohhhhh

#

i didnt realize it was a seperate install

#

thanks

slim ibex
#

np

final iron
#

It's better to start with something that actually has good implementation like disnake than use discord slash now and have to relearn it when you eventually switch

slim ibex
#

^

final iron
#

The implementation varies greatly because the maintainers of the forks had to implement slash commands themselves

slate swan
#

l

hardy wing
#

real quick what does it mean when in the error box it says "int/float is not subscriptable"

slim ibex
#

integers and floats are not subscriptable like lists and dicts. you can't index them

unkempt canyonBOT
#

@final iron :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 2, in <module>
003 | TypeError: 'int' object is not subscriptable
sick birch
#

You'd need to do a bit of math to get the Xth digit of an integer

#

(i.e do integer division and % 10)

hardy wing
#

I was trying to multiply a number by a number in a table and it gave me that

#

so ig I have to make it a number?

sick birch
#

Can we see the code?

bold surge
#

what can i help him with

cyan ermine
#

how to make slas command?

final iron
#

I would suggest disnake

slate swan
tacit storm
#

all three have slash command capabilities.

slate swan
#

mhm

tacit storm
final iron
#

Even Danny has stated specifically that he doesn't like it

slate swan
#

alright

slate swan
#

yeah no shit, py-cord is literally discord.py but continued

#

im gonna try using disnake for now

#

py-cord works perfectly for me

final iron
tacit storm
tacit storm
#

i use pycord only because i dont care about slash commands

final iron
tacit storm
#

wait

#

i have a question about disnake

final iron
#

They're called forks for a reason

tacit storm
#

did they change their namespace?

final iron
#

Wdym?

tacit storm
#

discord.py has the namespace "discord" so does pycord

#

but did disnake change their namespace

final iron
#

No

#

It's disnake

cyan ermine
#

i want to do it for discord

#

not disnake

final iron
tacit storm
slate swan
#

ahh sigh if only slash commands were as simple as normal commands

#

so dumb my god

tacit storm
#

usually, discord.py is

import discord

after looking at disnake's github

i just saw its

import disnake not discord.

slate swan
#

Disnake changes the namespace only if you use the shim

final iron
slate swan
unkempt canyonBOT
tacit storm
#

ohh

cyan ermine
#
@client.slash_command(description="Responds with 'World'")
async def hello(inter):
    await inter.response.send_message("World")```
#

from disnake code

#

but ain't workin

final iron
#

Did you read the getting started I send?

cyan ermine
#

aa sorry nope

#

i did a bit

fickle bloom
#

I know of @ client.command()

But how can I just run a command in a loop? Say every 10 minutes to just have it log something to the chat?

patent lark
#

!d discord.ext.tasks.loop

unkempt canyonBOT
#

discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
patent lark
#

@fickle bloom ^

#

you could do it multiple ways, like writing your functionality under the decorator function itself, or possibly call a command when the decorator is called with Context.invoke()

cyan ermine
#
@client.slash_command(description="Responds with 'World'")
async def hello(inter):
    await inter.response.send_message("World")```
#

I don't understand da error

patent lark
#

i dont see an error.

cyan ermine
#

Dis error

patent lark
#

well its quite self-explanatory

cyan ermine
#

Pls explain

#

Idk anything

#

I learn from source codes

slate swan
#

Seems.like you're not using Disnake but some other fork/og dpy

patent lark
#

your bot object has no slash_command attribute. meaning, slash_command is not a thing with your bot object.

cyan ermine
#

so

#

i do import slash_command ?

slate swan
#

No

cyan ermine
#

So how to fix it

patent lark
#

that doesnt magically add an attribute to your bot.

slate swan
#

change your bot object from discord.ext.commands.Bot to disnake.ext.commands.Bot

patent lark
#

basically, use disnake. not discord.py

cyan ermine
#

oof

fickle bloom
#

new to python, sorry

#

Coming from react where you can just call a function like this

patent lark
#

if your send_message() function is under the tasks.loop() decorator, you need to start it via your on_ready() function. await send_message.start()

quaint scaffold
patent lark
#

unless there is a more efficient way?

fickle bloom
#

I don't have any decorators setup

quaint scaffold
#

You might want to reconsider your time.sleep(), and have an asyncio.sleep() to not block your program

fickle bloom
quaint scaffold
#

Yes

patent lark
#

you dont need to use pip

#

import asyncio

quaint scaffold
#

asyncio is the back bone of every Python async program

quaint scaffold
#

It's in the stdlib

patent lark
fickle bloom
#
@tasks.loop(seconds=5.0, count=5)
async def slow_count():
    print(slow_count.current_loop)

@slow_count.after_loop
async def after_slow_count():
    print('done!')

slow_count.start()
patent lark
#

as far as im aware, you need to start them via your on_ready function

hardy wing
#

what's a type of discord bot that hasn't been done yet

fickle bloom
fickle bloom
#

it fails immediately without client initially

#

when I move it its fine

patent lark
#

also, just a tip, dont name your bot object client this can be confusing and arguably incorrect as discord.Client() is a thing , you're naming the bot object "client".

fickle bloom
#
@ client.event
async def on_ready():
    slow_count.start()
    print("BigChuckle Initialized")

@tasks.loop(seconds=5.0, count=5)
async def slow_count():
    channel = client.get_channel(spam)
    await channel.send('some message')

This worked perfectly.

fickle bloom
#

Also, what's best practice for var names? I think SnakeCase right

patent lark
#

it should be bot = commands.Bot(...)

sage otter
#

Thatโ€™s not snake case

#

Thatโ€™s pascal

fickle bloom
#

ah, snake_case

fickle bloom
#

is for functions right

patent lark
#

yes

fickle bloom
#

PascalCase for vars?

patent lark
#

pascal case is more for class definitions

fickle bloom
#

Ah okay

sage otter
#

pascal - class
snake - literally anything else

slate swan
#

camelCase is just something else

sage otter
#

Thatโ€™s not camel case

slate swan
#

other way around sorry

fickle bloom
#

Capitalization is explicit in React, if you use PascalCase it's a component 100%

slate swan
#

now it is

fickle bloom
#

Won't even compile properly, so I figured I'd ask to clarify

#

but it seems python doesn't really care much, I heard it changes performance though

sage otter
#

it doesnโ€™t

patent lark
sage otter
#

Itโ€™s just a naming convention

patent lark
fickle bloom
#

Do you have to declare or export vars for Globan python? Or can I just import X from Y?

#

In react we have to export var for example, for imports to work

#

Tbh, I should just read through pythons docs, unless there's a better resource

patent lark
#

yep

#

!docs

unkempt canyonBOT
slate swan
#

you dont need to export anything, you may directly from x import y

sage otter
patent lark
#

!pep8

fickle bloom
#

๐Ÿ˜ตโ€๐Ÿ’ซ tabs or spaces, oh no ๐Ÿ˜†

sage otter
sage otter
#

With a width of 4 spaces

slate swan
#

1 space indents

patent lark
sage otter
#

You know thatโ€™s what I meant smh.

patent lark
#

mhmm

sage otter
cyan ermine
#
@client.slash_command(description="Kicks a member") 
@client.command(brief="Kicks a user")
async def kick(inter):
    print("test")
    try:
        try:
            await user.send(f"You've been kicked from {ctx.guild.name} for reason **{reason}**.")
        except:
            await ctx.send("Couldn't send a DM to the user.")
        await user.kick()
        await ctx.send(f"{user} was kicked for reason **{reason}**")
    except Exception as e:
        await ctx.send(e)  ```
idk y aint workin
#

i did wrong ig as i copy normal kick code and put it under slash command

patent lark
#

how can you call the send method with Context when your only parameter is inter?

snow ibex
#

Where is ctx

patent lark
#

and in this function, user isnt defined.

#

nor is reason

cyan ermine
#

oof

patent lark
#

and why is there a nested try and except

cyan ermine
#

so wut i do?

snow ibex
#

Yeah these are not defined in this code block

patent lark
#

just simply, learn python.

#

you are far ahead of yourself.

cyan ermine
#

ok

snow ibex
#

Oh your trying to error handle you can make a handler for that you don't need to wrap each command in a try catch

#

Try except*

fickle bloom
#
async def remove_deafen():
    marcus = 121466391231463###
    user = await client.fetch_user(marcus)
    await user.edit(deafen=True)

(# for redacted numbers)
in remove_deafen await user.edit(deafen=True) AttributeError: 'User' object has no attribute 'edit'

How come I can't edit this value?

patent lark
#

use the member object

slate swan
tacit storm
fickle bloom
patent lark
slate swan
patent lark
patent lark
#

!d discord.Member

unkempt canyonBOT
#

class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User").

x == y Checks if two members are equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

x != y Checks if two members are not equal. Note that this works with [`User`](https://discordpy.readthedocs.io/en/master/api.html#discord.User "discord.User") instances too.

hash(x) Returns the memberโ€™s hash.

str(x) Returns the memberโ€™s name with the discriminator.
tacit storm
patent lark
fickle bloom
#

can I get a discord.Member from an id?

patent lark
#

but there is a member converter you can use to convert User to Member

tacit storm
patent lark
#

but i forgot the exact tag

patent lark
patent lark
fickle bloom
patent lark
fickle bloom
#

Well, long story short. We have one person who constantly is getting deafened as a joke

#

and to help him I want to undefean him every 15 seconds

patent lark
# fickle bloom Im a bit confused I suppose

you are currently using ``fetch_user()` which returns a User object, im saying there is no fetch_member() attribute for the member object so you should probably use a member converter

patent lark
fickle bloom
#

So use this on my user object?

#

Ah okay, so use get_user instead

snow ibex
#

Guild has fetch member

fickle bloom
patent lark
#

not if you use get_guild()

fickle bloom
#

Only places I am using guild I have context

snow ibex
#

Well can't you find guild from bot idk

fickle bloom
patent lark
fickle bloom
#

client.get_guild?

snow ibex
#

Mhm

patent lark
snow ibex
fickle bloom
#

awesome

#

Thanks!

snow ibex
#

Np my g anytime

patent lark
#

then you'll use guild.fetch_member()

#

does guild have a get_member as well?

fickle bloom
#

get_guild() -> Returns a guild with the given ID.

snow ibex
patent lark
#

!d discord.Guild.get_member

unkempt canyonBOT
patent lark
#

it does

fickle bloom
#

what id do I pass to get_guild?

patent lark
snow ibex
patent lark
#

the server you're using this bot on

snow ibex
#

Yeah

patent lark
#

@fickle bloom now.

bot.get_guild(id)
guild.get_member(id)``` simple
#

you will then have accessed the Member object

fickle bloom
#

wait, where can I find my guild id lol

patent lark
#

right click on the guild name and copy the id

snow ibex
#

Right click the name of the guild and copy Id

fickle bloom
#

you guys are awesome

patent lark
#

no problem

snow ibex
#

This is what we do yes

fickle bloom
#

If you ever need help I do the same thing you do here, but for React Native in reactiflux ๐Ÿ˜‰

patent lark
#

im actually in a call with a friend who needs help regarding react

snow ibex
#

Javascript? I'm trying to learn it rn

#

Well I'm trying to learn type script but eh

fickle bloom
#

React Native is Kotlin/Java, Swift/Obj-c and JSX

snow ibex
#

O kotlin

#

And java

pliant gulch
#

Objective c ๐Ÿ˜”

fickle bloom
#

But, I mainly try to avoid anything on the native side as much as possible.

snow ibex
fickle bloom
#

React Native is heavily switching to C++ in it's core

pliant gulch
#

Apple uses swift now

snow ibex
pliant gulch
#

Mmm c++ is great

snow ibex
#

Cpp is amazing

#

I prefer pure c tho

pliant gulch
#

I guess you like hurting yourself mentally

fickle bloom
#

C++ with JSI (Javascript + C++ basically)

It's super cool, if you want to nerd out look at React Native Fiber and how they're using C++ and JSI to make mobile applications blazing fast

fickle bloom
snow ibex
maiden fable
#

๐Ÿ‘€

pliant gulch
#

Inb4 you malloc hella bytes and you forget to free

#

Inb4 you do pointer arithmetic

fickle bloom
#
guild = await client.get_guild(guild_id)
user = await guild.get_member(marcus)
await user.edit(deafen=True)

Have this right now

#

Ok, it didn't like those awaits so I removed them.

But now I get this

await user.edit(deafen=True)
AttributeError: 'NoneType' object has no attribute 'edit'
slate swan
#

client.get_guild is not an awaitable

#

and so it get_member

slate swan
#

and marcus too

fickle bloom
# slate swan and so it get_member
    marcus = 121466391231463###
    guild_id = 169220321365327###
    guild = client.get_guild(guild_id)
    user = guild.get_member(marcus)
    await user.edit(deafen=True)
slate swan
#

yea, what's the marcus variable?

final iron
#

Is the guild in the bots cache?

patent lark
slate swan
#

the guild is found, member is not

final iron
#

member in cache?

fickle bloom
slate swan
fickle bloom
#

weird reasons I know

slate swan
#

ohok, seems like the member is not in the cache, do you have member intents?

patent lark
#

if you want to undeafen, why are you setting deafen to True

fickle bloom
#
import discord
import requests
import time
import asyncio
from discord import message
from discord.ext import commands, tasks
from discord.utils import get
from discord.ext.commands import has_permissions, CheckFailure
import random
import sqlite3
import json
import time

These are all my imports

slate swan
#

i mean intents

#

!intents this

unkempt canyonBOT
#

Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default, discord.py has all intents enabled, except for the Members and Presences intents, which are needed for events such as on_member and to get members' statuses.

To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.

Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

intents = Intents.default()
intents.members = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.

slate swan
fickle bloom
fickle bloom
slate swan
#

use aiosqlite

fickle bloom
#

Thank you :)!

slate swan
#

!pypi aiosqlite

unkempt canyonBOT
snow ibex
#

It's sqllite 3 but async await

fickle bloom
#

this was disabled, adding it now.

#

do I need to revalidate anything for the bot in the server?

#

Okay, it worked! I got it

snow ibex
#

Great!

fickle bloom
#

it deafens and undeafens now

#

thanks all!

snow ibex
#

Np np

fickle bloom
#

Can we change the duration of a users timeout?

patent lark
#

with disnake, yes

#

!d disnake.Member.timeout

unkempt canyonBOT
#

await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Times out the member from the guild; until then, the member will not be able to interact with the guild.

Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.

You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.

New in version 2.3.
slate swan
#

or you can use Member.edit if you want to edit the user at the same time

fickle bloom
#

Or just an import?

slate swan
fickle bloom
#

Never heard of disnake

patent lark
#

ah

fickle bloom
#

I'm using the discord py library

patent lark
#

discord.Member.timeout isnt a thing and never will be.

#

?

slate swan
#

Oh

patent lark
#

incorrect.

slate swan
#

Discord

patent lark
#

again, discord.Member.timeout isnt a thing, and never will be

fickle bloom
#

any difference in using disnake over discord py?

patent lark
#

disnake has the new features discord is coming out with, such as timeout

#

they function the same

slate swan
patent lark
#

as they copied the internals and added onto them

slate swan
patent lark
#

disnake is currently still maintained, so its updating accordingly to discords new features, as discord.py has been left unfinished, no longer being worked on.

fickle bloom
snow ibex
#

id recommend disnake

fickle bloom
#

going to try and implement this timeout

snow ibex
#

(pst.... if you are trying to make a music cog at somepoint ||stealthy wavelink ๐Ÿ˜‰ ||)

fickle bloom
#
Exactly one of duration or until must be provided. To remove a timeout, set one of the parameters to None.

Like this?

await user.timeout(duration=None)

Or like this?

await user.timeout(duration="None")
fickle bloom
#

Missing Permissions
Seems I am missing permissions to timeout

final iron
#

!e

var = None
var_ = "None"
if var is None:
    print("A")
if var_ is None:
    print("B")
unkempt canyonBOT
#

@final iron :white_check_mark: Your eval job has completed with return code 0.

A
final iron
#

"None" is not None

fickle bloom
#

user member how can I see if a user is in voice? I see voiceState but its a bit confusing

sage otter
#

Check if member.voice is not none

fickle bloom
#

user.VoiceState.channel?

sick birch
#

Check the channel, it'll be none if they're not connected.

sage otter
#

I mean just checking member.voice is enough

sick birch
#

๐Ÿค” Alright give it a try

sage otter
#

If they're not in VC then they wonโ€™t have a VoiceState established

fickle bloom
patent lark
sage otter
#

he do be helpin

slate swan
#

anyone know if would be possible to import google translate into my bot, and have a built in translator? like you would input the text language, then the language you want to translate to, and finally the text and it would translate the text into the set language? I know google translate isn't very accurate but it might be some help

sage otter
#

!pypi googletrans

unkempt canyonBOT
slate swan
#

oh sick

#

thx

sage otter
sick birch
fickle bloom
slate swan
#

what's that?

sage otter
fickle bloom
#

No parenthesis, I'm not going to lie. I kind of hate that ๐Ÿ˜†

#

AirBnB has a similar rule in JS where single line returns should never be multi-lines in paranthesis.

sage otter
#

Then be lucky python supports both

fickle bloom
#

I prefer to use what most people are using

#

I'll refer to pip8 and use that

sick birch
sage otter
#

you've already become 10x better than most of the people here including myself for following pep8

slate swan
#

May not be python

#

But it's a horror show for pep8 if it were

sage otter
final iron
slate swan
fickle bloom
#
 await guild.unban(user=nicholas, reason=None)

user=nicholas here has an example of abc.SnowFlake Do I need to provide the users discord name? Or do I need to provide a member object? Very confusing

slate swan
fickle bloom
# slate swan https://github.com/top-gg/luca
Discord.on("message", function (message) {
  var boolean = true;
  if (!!!!Boolean(boolean) !== false && Boolean(boolean) === true) {
    {
      {
        {
          {
            {
              {
                {
                  {
                    {
                      {
                        if (!!!!Boolean(message.content.includes("discord.gg")) === true && Boolean(message.content.includes("discord.gg")) !== false) {
                          message.delete();
                          message.reply("No Invites!!1! You will get baned soon.")
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
});

Jesus.

sick birch
#

what's wrong with the code lol

fickle bloom
#

this shouldn't be allowed to exist

sick birch
#

something is def not right

#

as someone who works with javascript a lot this hurts me

fickle bloom
#

I'm never seen !!!!Boolean and I've worked in JS for 7 years now

slate swan
#

Idk if it's just on mobile but this looks ugly

sick birch
unkempt canyonBOT
#

class discord.abc.Snowflake```
An ABC that details the common operations on a Discord model.

Almost all [Discord models](https://discordpy.readthedocs.io/en/master/api.html#discord-api-models) meet this abstract base class.

If you want to create a snowflake on your own, consider using [`Object`](https://discordpy.readthedocs.io/en/master/api.html#discord.Object "discord.Object").
sick birch
#

almost all models in discord.py abstract it since almost everything in discord is a snowflake (an id)

#

you can make your own using: discord.Object(id)

slate swan
#

Ohhh

fickle bloom
#

user = guild.get_member(nicholas)

#

would this work?
await guild.unban(user=user, reason=None)

#

Or, instead do I have to pull it from a banned list, instead of guild?

slate swan
unkempt canyonBOT
#

bot.js lines 318 to 322

if (process) {
 process.token = 'MjY0ODExNjEzNzA4NzQ2NzUy.C0grJQ.dGhpc2lzYWZha2VfdDBrM251bnViLi4u';
} else {
  window.token = 'MjY0ODExNjEzNzA4NzQ2NzUy.C0grJQ.dGhpc2lzYWZha2VfdDBrM251bnViLi4u';
}```
slate swan
#

๐Ÿ’€ why they do this

sage otter
sage otter
slate swan
#

But but you need to fetch user

#

because it is not a member anylonger

sage otter
#

guild.get_member would return None if they banned

slate swan
#
Guild.unban(discord.Object(id=id))``` 
is the best way imo
quaint scaffold
#

^ it is the best way

fickle bloom
#

Also, does python have a map function like js?

Array.map((value) => {})

I'm assuming, for each or similar

#

Ah it does, sweet

slate swan
#

correction : it raises 404

fickle bloom
#

Yea so I need to check

sage otter
#

Of you could just try/catch

fickle bloom
#

even easier

sage otter
#

in py try/except

slate swan
#

*except

sage otter
#

Listen Iโ€™m just talking in his native tongue of js

slate swan
#

understandable :3

fickle bloom
#

what do I except?

#

except 404?

#

or can I leave it blank

sage otter
#

discord.HTTPException

sage otter
#

Bare exception clause

fickle bloom
sage otter
#

PEP8 song ~ be specific

#

If you know what error your code is gonna throw than catch that specific error.

fading harness
#

@discord.command()
def printer(ctx, user: User=None, link: str=None):
    "Print. That's all."
    params = {}
    pattern = 'https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)'
    if user is None and link is None:
        params['image_url'] = ctx.author.avatar_url
    elif user is None and link is not None and re.fullmatch(pattern, link):
        params['image_url'] = link
    elif user is not None and link is None:
        params['image_url'] = user.avatar_url
    elif user is not None and link is not None:
        return "Sorry, but it looks like you can't fill all of the two arguments!"

    answer = proc.request('print', params)
    with open(f"{ctx.id}.png", "wb") as f:
        f.write(answer)
    ctx.send(Message(file=(f'{ctx.id}.png', open(f'{ctx.id}.png'), 'image/png')))
    os.remove(f'{ctx.id}.png')
#
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask/app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_discord_interactions/discord.py", line 523, in interactions
    return jsonify(self.run_command(request.json).dump())
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_discord_interactions/discord.py", line 440, in run_command
    return command.make_context_and_run(self, current_app, data)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_discord_interactions/command.py", line 177, in make_context_and_run
    result = self.run(context, *args, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_discord_interactions/command.py", line 195, in run
    return self.command(context, *args, **kwargs)
  File "app.py", line 47, in printer
    ctx.send(Message(file=(f'{ctx.id}.png', open(f'{ctx.id}.png'), 'image/png')))
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/flask_discord_interactions/context.py", line 399, in send
    message = requests.post(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/api.py", line 117, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/sessions.py", line 515, in request
    prep = self.prepare_request(req)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/sessions.py", line 443, in prepare_request
    p.prepare(
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/models.py", line 321, in prepare
    self.prepare_body(data, files, json)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/models.py", line 514, in prepare_body
    (body, content_type) = self._encode_files(files, data)
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/requests/models.py", line 161, in _encode_files
    fdata = fp.read()
  File "/usr/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x87 in position 10: invalid start byte

#

i am using flask-discord-interaction

sage otter
#

Advent of code completionist using is None instead of just if not smh

#

Just kidding btw

slate swan
# fickle bloom `except 404`?
discord.errors.NotFound: 404 Not Found (error code: 10026): Unknown Ban``` would be the error so you might be using `discord.NotFound`
fading harness
#

i am new to this library so...

pliant gulch
#

What's wrong with is None

sage otter
#

I thought it throws HTTPExeption tho WhatTheFlipFloppingFuc

fading harness
pliant gulch
#

NotFound is a child class of HTTPException

fading harness
#

!pip Flask-Discord-Interactions

unkempt canyonBOT
slate swan
#

could you link the library?

#

thnks

#

why not just use some discord.py fork? this library seems a bit confusing and not too well documented

fading harness
#

since replit sucks with hosting discord bot with gateway

slate swan
#

do you mean "too much" in terms of resources?

sage otter
fading harness
sage otter
#

Same reason why people use
if not something instead of using if something == False or some shit.

cyan ermine
#

how to import intents

fading harness
unkempt canyonBOT
#

class discord.Intents(**kwargs)```
Wraps up a Discord gateway intent flag.

Similar to [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the properties provided are two way. You can set and retrieve individual bits using the properties as if they were regular bools.

To construct an object you can pass keyword arguments denoting the flags to enable or disable.

This is used to disable certain gateway features that are unnecessary to run your bot. To make use of this, it is passed to the `intents` keyword argument of [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").

New in version 1.5...
fading harness
#

if you want to use presence and member intent you must beg discord for them

sage otter
cyan ermine
#
status = disnake.Status.idle, intents = disnake.Intents.all(),
activity=disnake.Game(name="Watching people play minecraft")
client.central = client.get_user(933326881237905468)```
#

Any solution for it?

slate swan
#

client.central? what is it

cyan ermine
#

Oof wait

#

i bymistake put it

green veldt
#

how to add embed to my bot?

slate swan
unkempt canyonBOT
#

class discord.Embed(*, colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty, timestamp=None)```
Represents a Discord embed.

len(x) Returns the total size of the embed. Useful for checking if itโ€™s within the 6000 character limit.

bool(b) Returns whether the embed has any data set.

New in version 2.0.

Certain properties return an `EmbedProxy`, a type that acts similar to a regular [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") except using dotted access, e.g. `embed.author.icon_url`. If the attribute is invalid or empty, then a special sentinel value is returned, [`Embed.Empty`](https://discordpy.readthedocs.io/en/master/api.html#discord.Embed.Empty "discord.Embed.Empty").

For ease of use, all parameters that expect a [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") are implicitly casted to [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.9)") for you.
green veldt
#

Thanks!

#

but

slate swan
#

yw

cyan ermine
#

!d client

unkempt canyonBOT
#
slate swan
unkempt canyonBOT
#

class discord.Client(*, loop=None, **options)```
Represents a client connection that connects to Discord. This class is used to interact with the Discord WebSocket and API.

A number of options can be passed to the [`Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client").
cyan ermine
#

ty

slate swan
#

the docs command has 41 packages so youll have to be specific

#

discord.py stopped being maintained so no updates disnake is a fork and hikari is another wrapper

neat tartan
#

Dpy is still a valid option afaik. Aside from that any of the branches will work just as well from what ive heard and seen

slate swan
#

dpy is still valid until breaking changes to the api

strong vessel
#

when will there be breaking changes to the api?

slate swan
strong vessel
#

ok

slate swan
#

i dont work in discord

neat tartan
#

Hopefully never unless they add new things the api can affect

slate swan
boreal ravine
#

pycord

slate swan
#

disnake is active

#

pycord is overrated

neat tartan
#

Disnake i think is the big one rn

slate swan
#

like hard

cyan ermine
#

disnake is gr8

strong vessel
boreal ravine
boreal ravine
strong vessel
#

oh i get it nvm

sage otter
#

Honestly all the forks are overrated since they all suck balls

boreal ravine
slate swan
#

im to lazy to learn hikari tbh

neat tartan
#

Ive been using and plan on sticking with dpy for the time being

slate swan
#

no timeout feature for you

boreal ravine
boreal ravine
slate swan
slate swan
boreal ravine
strong vessel
#

isn't that the point of the forks though

slate swan
#

if someone is so smart to make a request how did he or she not consider to migrate?

strong vessel
#

idk i'm not that smart

boreal ravine
#

be smarter

slate swan
boreal ravine
#

easy

slate swan
#

when the changes come rip

#

you know hows discord with its changes

sage otter
slate swan
#

i had a stroke reading that

neat tartan
#

Cant wait for all the crypto scams to come

slate swan
#

ยฏ_(ใƒ„)_/ยฏ

slate swan
#

isnt a wrapper supposed to be user friendly?

strong vessel
#

i'm sure they're just trolling

sage otter
#

Yeah, because I am.

slate swan
#

tyler you cant troll bro

#

tyler are you trolling or you got confused and said you were trolling

sage otter
#

I was trolling okimii

slate swan
sage otter
#

Anytime I add Ez to anything it often means Iโ€™m joking.

slate swan
#

im trolling

strong vessel
#

is it bad that i'm enjoying this

slate swan
neat tartan
cyan ermine
#

can you give code of kick command but in slash format?

slate swan
#

yeah my pfp has anime in it๐Ÿ˜”

cyan ermine
#

I don't understand how to convert it into slash

boreal ravine
#

you don't learn a library..

neat tartan
cyan ermine
#

I'm not askin for spoonfeedin dude

slate swan
cyan ermine
#

I want a rough example of how to convert normal command into slash

slate swan
#

i hate how my keyboard doesnt copy paste

boreal ravine
cyan ermine
#

disnake

slate swan
cyan ermine
#

Tysm

strong vessel
#

what is best discord library... i had to ask

slate swan
#

any fork is good(for migration)

cyan ermine
#

hikari maybe

#

all are good

neat tartan
#

Its all preferance

#

They essentially all do the same thing just in slightly different ways

slate swan
#

yeah but some are better than the others in src code

snow ibex
#

in python

#

in c# i use discordsharp+

slate swan
#

trash

#

discord.rb for ever

boreal ravine
sage otter
#

djs is objectively trash due to the fact itโ€™s built for a language that is trash.

snow ibex
#

CDISCORD!

slate swan
#

discordrb

boreal ravine
#

djs is one of the best discord libraries out there

snow ibex
#

wonder if some mad lad made a discord bot with assembly

boreal ravine
#

has lots of maintainers

#

daily commits

snow ibex
slate swan
#

discordrb cuz its so raw you have to make request to the endpoint to make reactionsyert

strong vessel
#

nah i prefer python

#

i'd never use discord js

sage otter
#

kayle you're actually trolling.

boreal ravine
snow ibex
boreal ravine
snow ibex
#

shouldve mentioned that

#

kayle vibin

sage otter
#

If you're trying to imply that d.js was better than d.py when it was still maintained istg.

slate swan
#

i cant tell if this channel is trolling or not

slate swan
#

oh no

#

andy is here time to get smort guys

sage otter
#

Iโ€™m leaving, Andy is here.

#

๐Ÿšถ

pliant gulch
#

I haven't even said anything bro

slate swan
slate swan
#

to send a whole wikipedia page

#

of info

#

๐Ÿคธ

pliant gulch
#

Well, all I'm gonna say is djs is a powerhouse, imo discord.py is after it

pliant gulch
#

djs literally has, a cluster manager, so many more features, voice receive etc

slate swan
#

youre mad discordrb is the best

pliant gulch
#

Also there events are more conventional than discord.py's

#

Emitters, subscribers, etc

strong vessel
#

if a discord bot hits 75 servers on April 2022 onwards, will it immediately become broken by discord?

#

nvm

strong vessel
slate swan
#

youll need to ask for intents

neat tartan
#

Oh

#

Fun

strong vessel
#

i mean of course i assume its a mistaken implication that they accidentally missed out on

sage otter
pliant gulch
sage otter
#

That doesnโ€™t mean anything AMshrug

pliant gulch
#

If it was objectively trash, I'm sure the community would've switched to something better no?

sage otter
#

PHP is used a lot in the internet but itโ€™s still objectively trash.

pliant gulch
#

Yes, and people upgraded from php to javascript

slate swan
#

google has python in itjam_cavedude

sage otter
#

I mean thatโ€™s whatever ig. I got nothing more to say. AMshrug

strong vessel
#

i'm just lazy to learn the intricacies of multiple languages

#

like i find it tiring to keep up

slate swan
#

lans are easy after you know python all you need to learn is syntax

neat tartan
#

Learning different coding languages is just like learning a new library

sage otter
strong vessel
#

nvm i have to learn js anyway

strong vessel
#

i might use discord js if it's that much better

slate swan
#

gl with that ig

strong vessel
#

nah , idk js seems a lot harder than python, i wanted something simple

#

nvm

slate swan
#

i mean yeah ofc python is simple compared to other lans

neat tartan
#

Youll probably do better just sticking with the language you know and using a different lib within it than learning a new langauge and library

slate swan
#

ruby is like python but less powerful and easier compared to python which is for complicated stuff

strong vessel
slate swan
#

that dont have slash commands

strong vessel
#

this update is really annoying

slate swan
#

ยฏ_(ใƒ„)_/ยฏ

strong vessel
#

oh i get it

#

it has workarounds built into it so actually its not as bad as i thought

slate swan
#

its just a change to the api

strong vessel
#

it's annoying though it means having to refactor the bot

slate swan
#

just apply for it

strong vessel
#

ok sure i'll try be positive about it

slate swan
#

youll need to read what makes your bot acceptable to the intent

strong vessel
#

i mean, basically it means i should never use prefix, and only use mentions in all bots..

#

it looks like that is what the giant article sums up to

neat tartan
#

Good thing i was planning on swapping to mentions

slate swan
#

i prefer slash commands

neat tartan
#

I might do them at some point instead but im tired of prefixes overlapping other bots

slate swan
#

slash commands dont overwrite or mentions since it contains a snowflake

neat tartan
#

Litterally changing the prefixes section to "@<bot>" should get around that right?

strong vessel
#

yeah but i have to learn how to do that

neat tartan
#

Prefixes

slate swan
#

and no thats not the write formatting

strong vessel
#

idk how it works, i do not think it is simple though

slate swan
neat tartan
#

Fuuu

#

Ok

strong vessel
#

its not super hard but... like its important to start early instead of getting all the users used to prefixes and then changing to mentions

slate swan
strong vessel
#

dang i really have to put effort into refactoring the bot and learning how to make it adapt to these new rules though

slate swan
#

you have until april

#

you were giving like a year iirc

neat tartan
#

What i meant was i cant just swap the ! On line 10 to a bot mention

strong vessel
#

actually the more i read it, discord really wants us to refactor our bots

#
We expect most bots and apps to migrate to new ways of engaging with users, like slash commands and other interactions. Please bear in mind that only bots that perform unique behaviors (that cannot be performed by Interactions) will be eligible for this intent.
neat tartan
#

What does unique behavior mean?

#

More so what does interactions mean

strong vessel
#

it means that you could not fulfill your bots behavior without mentioning the user or using DM

#

in other words... they are banning prefixes

quick gust
#

things which require message content intent, mostly moderation stuff

strong vessel
#

i wish they were more straightforward about it 'we are banning prefixes', it took me so much analysis to figure that out

quick gust
#

It still won't affect bots in less than 100 servers and unverified bots

quick gust
neat tartan
#

Aight so im still good for quite a bit with my test bot

strong vessel
#
This change affects only verified bots, bots that are in 75 or more servers. Unverified bots in fewer than 75 servers are not affected at all.
slate swan
quick gust
#

not sure, it's probably 75 i guess then

unkempt canyonBOT
#

disnake.ext.commands.when_mentioned(bot, msg)```
A callable that implements a command prefix equivalent to being mentioned.

These are meant to be passed into the [`Bot.command_prefix`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Bot.command_prefix "disnake.ext.commands.Bot.command_prefix") attribute.
slate swan
#

its 75

neat tartan
quick gust
#

yeah ok

slate swan
unkempt canyonBOT
#

discord.ext.commands.when_mentioned(bot, msg)```
A callable that implements a command prefix equivalent to being mentioned.

These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.
slate swan
#

!d discord.ext.commands.when_mentioned_or

unkempt canyonBOT
#

discord.ext.commands.when_mentioned_or(*prefixes)```
A callable that implements when mentioned or other prefixes provided.

These are meant to be passed into the [`Bot.command_prefix`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.command_prefix "discord.ext.commands.Bot.command_prefix") attribute.

Example

```py
bot = commands.Bot(command_prefix=commands.when_mentioned_or('!'))
```...
slate swan
#

if you want a prefix as well

strong vessel
#

i guess this means using discord py becomes a worse idea now

quick gust
#

ofc

#

It's a breaking change

strong vessel
quick gust
#

Yes

#

Bot can still see pinged message content

stuck flare
#

what does "*" do

strong vessel
#

so i can use prefixes in april 2022 discord without mentioning the bot?

quick gust
#

message content if it's pinged in it*

slate swan
quick gust
quick gust
strong vessel
#

i mean.. i'm trying to design my bots so they can be used beyond 75 servers

stuck flare
quick gust
#

use slash commands

cyan ermine
#
@client.command(brief="DMs a user")
async def dm(ctx, user:disnake.Member, *, msg):
   try:
        try:
            await user.send(f"You've recieved a message from {ctx.guild.name} saying '{msg}' .")
        except:
            await ctx.send("Couldn't send a DM to the user.")
        await user.kick()
        await ctx.send(f"{user} has recieved the message")
    except Exception as e:
        await ctx.send(e)```
#

Ain't workin

strong vessel
#

i do not want anything that would break

slate swan
# quick gust wrong reply?

if it doesnt have message intents it cant access the message content dpy checks message mentions if it got mention

quick gust
#

apply for message content if you really need it

slate swan
stuck flare
#

what does "*" do

quick gust
strong vessel
slate swan
cyan ermine
#

hi

slate swan
cyan ermine
#

can you help me out?

@client.command(brief="DMs a user")
async def dm(ctx, user:disnake.Member, *, msg):
   try:
        try:
            await user.send(f"You've recieved a message from {ctx.guild.name} saying '{msg}' .")
        except:
            await ctx.send("Couldn't send a DM to the user.")
        await user.kick()
        await ctx.send(f"{user} has recieved the message")
    except Exception as e:
        await ctx.send(e)```
stuck flare
cyan ermine
neat tartan
quick gust
#

only if it's pinged in the said message, will it check the message content

quick gust
#

bruh

slate swan
#

it checks the message mentions not its content?

quick gust
#

ok i might be wrong let me re check

cyan ermine
#

Could you fix the code and send?

quick gust
neat tartan
#

Im on mobile so the formating is litterally unreadable even if it was correct so sadly i cant