#discord-bots

1 messages · Page 486 of 1

drifting arrow
#

try and replace 'print(today)' with 'print('it's here')'

slate swan
#

I will use it, This is just debugging

grand anvil
drifting arrow
#

@slate swan if you want to do a full debug. Print out all the variables as you make them.

#

Great way to find out what's being set properly and what's not.

grand anvil
#

@slate swan is the daily_poll.txt in same folder as your main file?

slate swan
#

Sigh why this have to be so complex

grand anvil
#

hmm

drifting arrow
#

@slate swan /shrug Probably missing a semicolon or something somewhere. Just print out all the variables and see what the issue is.

grand anvil
drifting arrow
#

I know @grand anvil

#

He could be missing something small. like a semicolon

#

or a dot

grand anvil
#

try to find out what step it breaks at

drifting arrow
#

or mispelled a word

#

or typed onions as onoins

grand anvil
drifting arrow
#

yes.

#

or did self.bot instead of just bot coz it's not a cog

#

who knows? print everything out.

#

Delete the prints once debug is over

slate swan
#
import discord
import asyncio
import pathlib

from pathlib import Path
from discord.ext import commands
from discord.ext import tasks
from datetime import datetime

this_file_directory = Path(__file__).parent.resolve()
other_file = this_file_directory / "daily_poll.txt"
with open(other_file, "r+") as file:
    daily_poll = [daily_poll.strip().lower() for daily_poll in file.readlines()]


class dailypoll(commands.Cog):
    def __init__(self, bot):
        self.bot = bot


    @tasks.loop(count=1)
    async def once():
        today = datetime.utcnow().strftime("%Y%m%d")
        with open('daily_poll.txt', 'r') as file:
            if today in daily_poll:
                print(today)
            else:
                print("Cant find it wot?")

def setup(bot):
    bot.add_cog(dailypoll(bot))

There you go 🙄

drifting arrow
#

I didnt say give us the code

grand anvil
#

add a print statement with step number after each step in the once()

drifting arrow
#

He's editing the code

slate swan
grand anvil
#

many times your function isn't invoked in first place and u try to find error inside function

drifting arrow
#

@grand anvil that's why I said to print out. The print won't run if the code is broken

grand anvil
#

happened with me couple of times

drifting arrow
#

or the print will display wrong.

#

Print is god. never disrespect the print

#

Got an error and unsure which variable? print all the variables.

grand anvil
drifting arrow
grand anvil
slate swan
#

Under self.bot =... add self.once.start()

grand anvil
#

rip

slate swan
#

Happens

drifting arrow
#

i never looked tbh. too busy telling @grand anvil that printing works.

#

i totes wouldnt have missed it tho 😎

grand anvil
slate swan
#

Yw

drifting arrow
grand anvil
drifting arrow
#

and if nothing prints. it means the fucntion isnt being called. Then we figure out why. work backwards.

#

If there's one thing I've learnt about debugging is to work backwards.
coz my code is always broken until it's not

slate swan
grand anvil
#

or just stick with whatever works for u

#

¯_(ツ)_/¯

drifting arrow
#

¯_(ツ)_/¯

slate swan
#

¯\_(ツ)_/¯

grand anvil
#

damn why is there no competitive programming channel?

drifting arrow
#

Wanna know what's totes fun tho? making a discord logging system to log all the events in the server \o/

drifting arrow
slate swan
#

Done that for mine

#

Must say I had a headache at the end

grand anvil
slate swan
#
TypeError: once() takes 0 positional arguments but 1 was given
drifting arrow
slate swan
#

It does have self

drifting arrow
#

if changing async def once(): to async def once(self): isnt the solution then i have no idea

#

and when you call it, are doing self.once.start()? and not once.start()?

drifting arrow
#

@slate swan don't act like you haven't once forgotten to put self in

#

.>

boreal ravine
#

.>?

drifting arrow
#

is face. from before you could emojis

boreal ravine
#

What

slate swan
#

Okay so no error but no print either now to see where it breaks

slate swan
#

The bot

slate swan
#

So the loop can start

drifting arrow
# slate swan U got a point

And with that being said. I totes have never done that and would never do that and nor would I copy and paste code from outside a cog into a cog and forgot to put self everywhere

drifting arrow
#

Happens all the time. I go to test code in different areas and forget to change a bunch of variables. so i run the code. breaks. fix. run. break. fix. repeat for like 50 errors

#

Gotta go faster

slate swan
#

Okay so I did this

    @tasks.loop(count=1)
    async def poll(self):
        print("Okay 1")
        today = datetime.utcnow().strftime("%Y%m%d")
        print ("Okay 2")
        with open('daily_poll.txt', 'r') as file:
            print("okay 3")
            if today in daily_poll:
                print("Okay 4")
                print(today)
            else:
                print("Okay 5")
                print("Cant find it wot?")

and its just spamming Okay 1 and Okay 2
(Wondering why it doesnt stop after saying it once?)

drifting arrow
#

try this:

@task.loop(seconds=5, count=1)

change 5 to whatever you want.

slate swan
#

Oh it started spamming Okay 1 and Okay 2 again

drifting arrow
#

oh and it's @tasks not @task see. mistakes people. mistakes. double check your spelling.

#

It makes me question how I even made it to my age..

slate swan
#

Okay now even though I put today variable in the txt it still prints cant find it

#

20210921 Dog or Cat?
Thats line one
datetime.utcnow().strftime("%Y%m%d") should print that

#

So it should find that

maiden fable
#

Where did u start it?

slate swan
#

Okay I got it to work!!!

drifting arrow
#

@slate swan are you converting your variable that holds the date you want to search for to a string?

dense swallow
#

how can i use except for throwing 2 errors?

drifting arrow
#

okay he got it guys

dense swallow
#

if it has HTTPExcpetion and Forbidden

slate swan
#

Thanks all of you for all the help 😩

#

Really apricated

drifting arrow
#

All me guys.

boreal ravine
#

whats the difference between on_message_delete and on_raw_message_delete

drifting arrow
#

So if you dont care about the original author of the message or the message contents, you can use on_raw_message_delete
otherwise use on_message_delete

eager raptor
#

May I know what's the reason for this error?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: unable to write data: [Errno 122] Disk quota exceeded

boreal ravine
#

oooo thanks

dense swallow
drifting arrow
boreal ravine
#

A deco that makes the command only usable in NSFW channels

dense swallow
#

A check() that checks if the channel is a NSFW channel.

drifting arrow
# boreal ravine ok

If you want my code I can share.but others consider it spoonfeeding. so up to you.

slate swan
#

Okay so I am back here for more help 🙄 Right now I am able to check if a line in a file has a certain word and print that word, How would I print the whole line which has that word?

boreal ravine
maiden fable
drifting arrow
#

and I discovered through testing. Once a message is deleted, you cant gather any details about it unless it was cached \o/

dense swallow
#

how can i throw 2 raises in one except ?

eager raptor
slate swan
# drifting arrow Can see code?
    @tasks.loop(seconds=5,count=1)
    async def poll(self):
        print("Okay 1")
        today = datetime.utcnow().strftime("%Y%m%d")
        print ("Okay 2")
        if today in daily_poll1:
            print("Okay 4")
            print(today)
        else:
            print("Okay 5")
            print("Cant find it wot?")
    
boreal ravine
#

dunno

drifting arrow
dense swallow
#

not like that

#

how can i fit it in one except

maiden fable
#

BTW can anyone here help me make a paginator?

So my AI API sends some data in the form of a dict, and I want to paginate it in an embed and control it with buttons... I want to show only a maximum of 10-12 entries on one page... Any help?

slate swan
drifting arrow
slate swan
spring flax
dense swallow
#

is there like a one liner?

drifting arrow
dense swallow
#
except Exception as e:
    await ctx.send(e)
``` this is possible, but will it send what is given in the docs?
eager raptor
maiden fable
maiden fable
#

Wait, nvm... I said buttons

#

Well yea... Just like the Python bot has

maiden fable
#

!d

drifting arrow
#

I'm still yet to get to buttons in discord. ;-;

unkempt canyonBOT
spring flax
#

reactions?

maiden fable
#

Instead of reactions, buttons

river walrus
drifting arrow
#

!d

spring flax
#

which library are you using for the buttons?

eager raptor
maiden fable
slate swan
river walrus
hasty iron
#

!d discord.ui.View

unkempt canyonBOT
#

class discord.ui.View(*, timeout=180.0)```
Represents a UI view.

This object must be inherited to create a UI within Discord.

New in version 2.0.
spring flax
#

yeah i know

#

but it's not the only lib with buttons

dense swallow
hasty iron
#

its the best one for buttons

maiden fable
#

Wait... I think I just gotta map the page number to the embed and just edit the message with the different embed, right?

hasty iron
#

all the other impls are trash

dense swallow
#

forks?

eager raptor
hasty iron
#

that too

river walrus
hasty iron
#

forks and third party libs

maiden fable
#

Suppose I have a dict, which has, uhh, say 15 keys... So how to do so that on each page of the paginator, only 10 keys are shown...? Like, I will have to slice the dict or something, ig?

hasty iron
#

you can slice the dict items

maiden fable
#

Wym? Like separate them or something?

hasty iron
#

because you cant slice a dict like you normally do with a list iirc

maiden fable
#

Hmm, well I was thinking of using dict.items()

hasty iron
#

dict.items is a list of tuples

maiden fable
#

Yea, it returns a list of tuples, so it can be sliced then, right....?

hasty iron
#

yes but i believe it returns a dict_items object so to be sure you can cast it to a list

maiden fable
#

Hmm ok

heavy radish
#

Why no work?

#

That's the embed title BTW

#

Well description

maiden fable
#

user isn't defined

slate swan
heavy radish
#

how?

#

User = discord.User

#

or member

wheat prawn
slate swan
#

Show me your full code

#

!d discord.on_member_join

unkempt canyonBOT
#

discord.on_member_join(member)``````py

discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") leaves or joins a [`Guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild "discord.Guild").

This requires [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
slate swan
#

Or follow this

heavy radish
#
@bot.group(invoke_without_command=True)
async def help(ctx):
  member = discord.Member
  embed = discord.Embed(title="", description=f"Welcome {Hello World}, to get help on a specific command type `??help <command>`", color=0x109319)
  embed.set_author(name="MultiversalBOT", icon_url= "https://i.imgur.com/jszzFTz.png")
  embed.add_field(name=":globe_with_meridians: General", value="`Ping`, `Uptime` & `RoomInfo`", inline=True)
  embed.add_field(name=":reminder_ribbon: Nitro/Donor Rooms", value="`Invite`, `Remove`, `Ban`, `Unban`, `Hide` & `Unhide`", inline=True)
  embed.add_field(name=":door: Private Room", value="`Pin`, `Unpin`, `Rename`, `Description` & `Slowmode`", inline=True)
  embed.add_field(name=":tools: Admin", value="`Shh`,`Shh` & `Shh`", inline=True)
  embed.add_field(name=":kite: Misc", value="`Vote` & `Donate`", inline=True)
  embed.set_footer(text="Founder of Multiversal • 【C E O】#8841")
  await ctx.send(embed=embed)
#

Oh nah. This is a command..

wheat prawn
#

why not subclassing default help command, this way is pain

heavy radish
#

Pardon?

slate swan
#

You want tag the author of command or other user?

heavy radish
#

whoever used the command

#

so author ig

slate swan
#

ctx.author

#

Use this

heavy radish
#

..

slate swan
#

ctx.author.mention

heavy radish
#

oki, thanks

trail breach
#

best way to store data for a bot??

cobalt jacinth
#

how can i get channel name if i have id ?
is it bot.get_channel("ID") ?
its not working for me.

slate swan
hasty loom
#

how do i convert user id into member object? ik u can do member: MemberConverter in the function but i want to do it in the middle of the command

unkempt canyonBOT
#

get_channel(channel_id, /)```
Returns a channel with the given ID.

Note

This does *not* search for threads.
slate swan
#

!d discord.Client.get_channel

unkempt canyonBOT
unkempt canyonBOT
lament mesa
maiden fable
#

Eh I have found a way, ig

slate swan
#

Right now I am able to check if a line in a file has a certain word and print that word, How would I print the whole line which has that word?

    @tasks.loop(seconds=5,count=1)
    async def poll(self):
        print("Okay 1")
        today = datetime.utcnow().strftime("%Y%m%d")
        print ("Okay 2")
        if today in daily_poll1:
            print("Okay 4")
            print(today)
        else:
            print("Okay 5")
            print("Cant find it wot?")
river walrus
trail breach
#

JSON?

river walrus
slate swan
river walrus
#

Postgres has an amazing lib for python

trail breach
maiden fable
#

L
O
L

trail breach
#

on_message is a special kinda function or its just conventional?

lament mesa
# maiden fable *both*

You can do something like this ```py
def format_pages(self, pages):
items_per_page = 10
for i in range(0, len(pages.items()), items_per_page):
next_pages = pages[i : i + items_per_page]
page_entry = ""

    for page in next_pages:
        # page is a tuple containing 2 items 
        page_entry += f"{page[0]} {page[1]}" # Do whatever you want here
return page_entry```
maiden fable
#

Yea, I am doing something like that only

#

Thanks BTW!

hasty loom
#

AttributeError: 'Test' object has no attribute '_members'

#

and yes id is valid i tested its an integer

lament mesa
#

it needs to be the guild instance

brazen raft
#

Maybe you meant ctx.guild.get_member(user_id=id)

broken igloo
#

Hello! How to localize discord bot?
For example, I have info about selected language in every guild in my database.

slate swan
hasty loom
#

i was just being dummy

crystal cliff
#

SyntaxError: EOL while scanning string literal
 {what does, this error mean?}

hasty iron
crystal cliff
#

thanks @hasty iron

heavy radish
#
embed.add_field(name="Description", description="Use this commmand to check the BOT's ping", inline=False)

Error = TypeError: add_field() got an unexpected keyword argument 'description

#

I don't see any type errors

broken igloo
heavy radish
#

ahh

slate swan
#

@drifting arrow Could I disturb you for a sec

    @tasks.loop(seconds=5, count=1)
    async def poll(self, message):
        print("Okay 1")
        today = datetime.utcnow().strftime("%Y%m%d")
        print("Okay 2")
        for single_line in daily_poll1.splitlines():
            if today in single_line:
                print("Okay 4")
                print (single_line)
                channel = self.bot.get_channel(789809104738189342)
                await channel.send(single_line)
                daily_poll1.close()
            else:
                print("Okay 5")
                print("Cant find it wot?")
TypeError: poll() missing 1 required positional argument: 'message'

Why does it say that even though I put in message?

trail breach
#

I hv a def on_message which is doing more than 1 task how can i make many functions doing these tasks cuz it seems that on_message is a special function name(myb idk much yet)?

velvet sinew
#

Can Someone give me music commands for bot

drifting arrow
slate swan
trail breach
#
@client.event
async def on_message(message):
    username_mention = message.author.mention
    
    username = str(message.author).split('#')[0]
    user_message = str(message.content).lower()
    chanel = str(message.channel.name)
    print(f'{username} : {user_message} ({chanel})')
    
    
    for i in range(0,len(HELLO),1):
    
        if username == str(client.user).split("#")[0]:
            return "avoiding bot"
        
        if  HELLO[i] in user_message  :
            print(username_mention)
            general_channel = client.get_channel(GENERAL)
            print('executed')
            await general_channel.send(f'Hello {username_mention}')
            return 
    
        for i in range(0,len(BYE),1):
    
            if username == str(client.user).split("#")[0]:
                return "avoiding bot"
        
            if  BYE[i] in user_message  :
                print(username_mention)
                general_channel = client.get_channel(GENERAL)
                print('executed')
                await general_channel.send(f'Hello {username_mention}')
                return 

    if user_message == 'what is the version':
        general_channel = client.get_channel(GENERAL)
        await general_channel.send(f'The verion is 1.0 {username_mention}')
        return
    if user_message in LIST:
        general_channel = client.get_channel(GENERAL)
        await general_channel.send(f'Language!!')
        return    ```
#

this func does more than 1 task whihci dont want

kindred epoch
#

.command function exists

trail breach
#

also here on_message is a keyword or something

trail breach
#

whats that?

kindred epoch
#

!d discord.ext.commands.Bot.command

unkempt canyonBOT
#

@command(*args, **kwargs)```
A shortcut decorator that invokes [`command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") and adds it to the internal command list via [`add_command()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin.add_command "discord.ext.commands.GroupMixin.add_command").
trail breach
visual island
#

its just a function name

trail breach
#

ohk

#

any gud docs out there

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message

heavy radish
#

~~How do I make @group.command() case insensitive ? ~~

kindred epoch
#

Wdym

#

Commands name case insensitive?

heavy radish
#

Ye, I figured it out

kindred epoch
#

Ok

heavy radish
#

Thank You!!

kindred epoch
#

Np

#

!d discord.ext.commands.Bot.case_insensitive

unkempt canyonBOT
#

Whether the commands should be case insensitive. Defaults to False. This attribute does not carry over to groups. You must set it to every group if you require group commands to be case insensitive as well.

cinder echo
#

What should I do if I want to get an input for a particular command as a web page? Should I change it to a django project?

granite prawn
#

can i get a user from his name and tag?

drifting arrow
granite prawn
#

generic

drifting arrow
#

and are you tagging them in a command? like $find @drifting arrow ?

granite prawn
#

yea

#

find with a tag and name arguement

#

and it returns user id

hasty iron
unkempt canyonBOT
#

get_member_named(name, /)```
Returns the first member found that matches the name provided.

The name can have an optional discriminator argument, e.g. “Jake#0001” or “Jake” will both do the lookup. However the former will give a more precise result. Note that the discriminator must have all 4 digits for this to work.

If a nickname is passed, then it is looked up via the nickname. Note however, that a nickname + discriminator combo will not lookup the nickname but rather the username + discriminator combo due to nickname + discriminator not being unique.

If no member is found, `None` is returned.
drifting arrow
#

Oh that's a thing?

granite prawn
#

oh wow cool

#

tysm

drifting arrow
#

I was gonna suggest like 5 different other things but here's a thing that does it all in 1 line

#

neato i guess

granite prawn
#

what if its not server specific?

hasty iron
#

then you'll have to loop through Bot.users

#

and find the user you want

brisk helm
hasty iron
#

what

#

they want to get a user from their tag and name

drifting arrow
#

Well if you can tag them like ( @drifting arrow ) they're already in the server anyway. so you can run a command using the member function

ocean leaf
#

Which database should I use for making levelling system and economy system of my discord bot if I am using replit?

lament mesa
#

MemberConverter can get the member from name#discriminator iirc

drifting arrow
#

stuff gets wild in other channels

ocean leaf
drifting arrow
#

I assume so since someone keeps bugging me about their sql code

hasty iron
lament mesa
#

yeah

boreal ravine
ocean leaf
#

btw how can i know the total number of messages in the current channel?

boreal ravine
#

seems sketch

ocean leaf
#

i'll change it

boreal ravine
#

wut

slate swan
unkempt canyonBOT
#

async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [`AsyncIterator`](https://discordpy.readthedocs.io/en/master/api.html#discord.AsyncIterator "discord.AsyncIterator") that enables receiving the destination’s message history.

You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.

Examples

Usage...
ocean leaf
#

it is for creating custom invite link for a discord server

ocean leaf
#

without boosts

boreal ravine
#

ok

ocean leaf
#

i'll change it

drifting arrow
#

oh apparently it linked. who woulda thunk

#

random letters /shrug

ocean leaf
#

i don't need it

ocean leaf
drifting arrow
#

Honestly just better off creating a non-expiring discord invite and if you post it on a website just change the url text or whatever

heavy radish
#

!code

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

heavy radish
#

!d code

unkempt canyonBOT
#

Source code: Lib/code.py

The code module provides facilities to implement read-eval-print loops in Python. Two classes and convenience functions are included which can be used to build applications which provide an interactive interpreter prompt.

hasty iron
ocean leaf
heavy radish
#

Whats the website to save alot of code??

hasty iron
#

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

heavy radish
#

Ahh thanks

#

Can I save this code?

drifting arrow
# ocean leaf how can i change the url text?

On a website? depends. if it's a website you own and edit, you can use the url anchor tag <a href="discordinvite">Join my discord!</a> or if you're on reddit, just change the text. etc.

#

Most websites these days have a way for you to format links so they look like a facebook.com link but it's actually facebock.com where you steal their data

ocean leaf
drifting arrow
#

Discord will make that giant box appear

#

saying "Developers discord click this shiny button to join"

ocean leaf
oak warren
#

how to count a mentioned reply as a parameter for discord.Member ?

hasty iron
#

what

drifting arrow
ocean leaf
#

i want to check the full channel

#

tbh i am making clearchannel command

oak warren
# hasty iron what

like this is a reply but if a command is used it wont take your user as a parameter

drifting arrow
drifting arrow
#

What do you want to do with the messages you grab? log them? or just delete?

hasty iron
#

!d discord.Message.reference

unkempt canyonBOT
#

The message that this message references. This is only applicable to messages of type MessageType.pins_add, crossposted messages created by a followed channel integration, or message replies.

New in version 1.5.

oak warren
#

okay

#

thanks

ocean leaf
#
@Client.command(pass_context = True)
async def clear(ctx, number):
    mgs = [] #Empty list to put all the messages in the log
    number = int(number) #Converting the amount of messages to delete to an integer
    async for x in Client.logs_from(ctx.message.channel, limit = number):
        mgs.append(x)
    await Client.delete_messages(mgs)
#

just got this from stackoverflow

#

lemme try

boreal ravine
#

@ocean leaf why copy code

hasty iron
#

its old code

drifting arrow
#

yeah that's not gonna work

hasty iron
#

and that clears messages not count them

drifting arrow
#

It's purge thesedays

#

i honestly think that's what he has been trying to do this whole time

#

he's just confused on how to do it

hasty iron
#

there are even examples on the doc page

ocean leaf
hasty iron
#

this indicates lack of knowledge

ocean leaf
#

just reading

hasty iron
ocean leaf
#

i made my own

#

i didn't copy

#

i read it

hasty iron
#

"just reading" "lemme try"

ocean leaf
#

and made my own

hasty iron
#

"just got this from stackoverflow"

ocean leaf
hasty iron
#

sure man

ocean leaf
#

i read the docs

#

they tagged the docs page

drifting arrow
hasty iron
#

what attitude

drifting arrow
#

He has copied like 4 lines which we all know wont work

hasty iron
#

here we go again with people picking up my "attitude" from messages

#

next time pick up my tone

drifting arrow
#

There's nothing wrong with what he did

hasty iron
#

also i dont even use dpy

#

i have a wrapper myself lol

ocean leaf
#

i read the docs

#

they have tagged it

hasty iron
#

the docs contain examples

#

use that as a reference for what you want to do

ocean leaf
hasty iron
#

dude

drifting arrow
ocean leaf
hasty iron
#

i just pointed to the fact that i made a wrapper myself

#

cuz the guy said to stop using dpy

jade jolt
#

im working on my own aswell

ocean leaf
jade jolt
#

hes not being aggressive 😐

hasty iron
#

ok lets drop this

boreal ravine
#

👀

drifting arrow
#

discordpy will eventually stop working. Some parts may break. some wont have all the new fancy stuff. But eventually it'll stop. But by then we'll move to whatever replaces it

#

atm i think it's disnake or whatever

hasty iron
#

atm its none

boreal ravine
#

disnake is meh

hasty iron
#

they're all shit

drifting arrow
#

disnake is the leading one from what I can pick up

#

Whenever someone asks for a fork, it's always disnake

boreal ravine
#

not really

#

hm

hasty iron
#

no fork is going to be at the quality of the original for months

jade jolt
#

^

hasty iron
#

we have pycord with their game breaking discord.Bot

boreal ravine
#

Lol

hasty iron
#

for some reason they decided that that was a good idea

jade jolt
#

why.

boreal ravine
#

I use pycord but I don't use the slash commands because it interferes with my prefixed commands

#

I only use the buttons/select menus as of now

hasty iron
#

those are in the normal 2.0

reef shell
#

Then use dpy v2.0

drifting arrow
#

Aight. I know ya'll like me so much. Wanna give me a code review?

jade jolt
#

lol

hasty iron
#

ok

drifting arrow
#

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

drifting arrow
#

This is my adminlogs i made today

hasty iron
#

first, variable names

#

userAvatar

drifting arrow
#

I'm looking for:
-This is nice.
-This could be shorter/better [explain how]

hasty iron
#

also so many useless imports

drifting arrow
#

alright. removed useless imports

hasty iron
#

and that picking up the deleter from logs might not always work

#

iirc if you delete your own message it wont show up there

drifting arrow
#

It will work

hasty iron
#

you're pretty much ok just by using the message object itself

drifting arrow
#

I tested that one the most Lol

#

It's how I found out that discord caches stuff

#

If your bot is online, your bot will cache all messages.

hasty iron
#

discord doesn't do that, its dpy

#

and dpy has a maximum for cached messages

drifting arrow
#

yeah thats what I meant

hasty iron
#

which defaults to 2000 i think

drifting arrow
#

I assume it deletes the oldest one first? if so, that's also fine

#

Besides, you dont want to get notified about something sent a month ago. just recent.

#

Which is fine

heavy radish
#
@help.command()
async def ping(ctx):
``` So I used `ping` as a command and this is the help version. But its giving me error since i've used it. Do I need to import something?
silk mauve
#

Guys, how can I have my game activity exactly like this

#

Whats the name of the plugin

#

I tried this one but it doesnt looks cool

heavy radish
#

Extension. named Discord Presence

drifting arrow
silk mauve
heavy radish
#

gives an embed where it explains what the command does

heavy radish
#

its on VSC

silk mauve
#

I got it

drifting arrow
silk mauve
#

ye ty

heavy radish
#

Huh

drifting arrow
#

Btw. my $help list is now 2 embs ;-;

heavy radish
#

Oh, i just saw off youtube

silk mauve
#

Does it work with py?

heavy radish
#

it did with VSC

silk mauve
#

Alr

heavy radish
#

But i'm transferring to replit (IK Leave me be)

silk mauve
#

I need to have VSC

#

So I cant download it

boreal ravine
boreal ravine
boreal ravine
silk mauve
#

Or god

#

good*

boreal ravine
silk mauve
#

For me it is

broken igloo
#

How to localize bot using gettext or something else?

boreal ravine
silk mauve
#

Funny

boreal ravine
#

𝖲

steep estuary
#

i am working with json and in discord.py :/ i am trying to store guild id in json file but it is showing keyerror in int so i tried str() but it is also giving error

steep estuary
glacial junco
steep estuary
#

??

#

json doesn't allow int as a key and also single quotes >:/

sleek ore
steep estuary
#

then how i can convet a int to double quotes string

#

wht?

drifting arrow
# boreal ravine Wot

when you do $help for your bot to view all commands, it'll break it into separate embs if necessary

sleek ore
broken igloo
steep estuary
#

tellllll

hasty iron
sleek ore
steep estuary
#

how i can specify to convet a int to str with double quotes >:/

sleek ore
sleek ore
#
if guild.id not in data:
    data[guild.id] = {"afk": []}
        if ctx.author.id in data[guild.id]['afk']:
            data[guild.id]['afk'].remove(ctx.author.id)
        else:
            data[guild.id]['afk'].append(ctx.author.id)
#

One method I get thought of @steep estuary

steep estuary
#

pls someone help i am in problem 😞

#

??

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message

steep estuary
#

but see

#

this is also giving error

#

this error

#

@river walrus

river walrus
hasty iron
#

dont ping random people

visual island
jade jolt
#

im in it

#

getting more, for a well maintained dev team

river walrus
#

Since the dev team is full now

jade jolt
#

yup

hasty iron
#

andy is in?

steep estuary
visual island
#

yep

jade jolt
#

yeah

river walrus
hasty iron
#

you could probably get nova too (431677941722906625) since he always cries about making something

drifting arrow
#

Ahuh! we've solved the issue.

stiff nexus
#

how many buttons can i get in a row?

steep estuary
maiden fable
#

Try printing the dict

hasty iron
#

also you're never closing the file which is bad

steep estuary
maiden fable
#

Yups... Use a context manager

hasty iron
#

you're opening it inside the arguments but never close it

steep estuary
#

this is the json file

visual island
steep estuary
#

my json file is empty

#

this will not make disct in json?

maiden fable
#

Rows in a message --> 5
Button in a Row --> 5
Selects in a row --> 1

Soo, a message can contain a maximum of 25 buttons or 5 dropdowns

maiden fable
#

Imagine sarcasm

steep estuary
#

json will also convert int to str automatically??

sleek ore
steep estuary
sleek ore
#

str(int)

steep estuary
#

should i use this

sleek ore
steep estuary
#

to make variables in json

#

?

visual island
maiden fable
sleek ore
steep estuary
#

it worked

sleek ore
#

To check if a user is afk, you just do user.id data[str(guild.id)]['afk']

steep estuary
drifting arrow
#

sighs

steep estuary
#

this worked but than also it gave a error

drifting arrow
#

Now I need something else to add to my bot

sleek ore
steep estuary
#

?

steep estuary
sleek ore
#

It's still raw, missing the open and close of the JSON file, some str() but that should give you the rough sketch

sleek ore
sleek ore
#

Basically the command is a toggle, if you're in the list, bot will un-afk, and vice versa

fast tree
#

Hello

drifting arrow
steep estuary
#

but i want the afk variable inside the user id :/

sleek ore
hasty iron
#

its better if you used a database

sleek ore
#

JSON is not a database

steep estuary
#

hmm

stiff nexus
steep estuary
#

i just want to store my variables

#

which i don't want to reset

hasty iron
#

yes a database does that

native harness
#

got this error

#

I cant really tell what its from

maiden fable
#

U forgot to await something

drifting arrow
#

\o/

native harness
#

uhhh

slate swan
#

can someone help me?

native harness
#
@client.command()
async def stealthban(ctx, ping : discord.Member = None):
    
    try:
        ping_id = ping.id
    
    except:
        pass

    author_id = ctx.author.id
    reason = "stealthban jutsu"

    if author_id in trusted_json:
        if ping_id == varsfile.creator_id:
            user = await client.get_user(author_id)
            message = "how dare you try to ban Master Radium!"
            await client.send_message(user, message)

        else:
            await ping.ban(reason=reason)
            await ctx.message.delete()
    
    else:
        pass```
visual island
native harness
#

ehhhh

maiden fable
#

Yea

slate swan
#

can someone help me?

native harness
visual island
#

101%

native harness
slate swan
#

ill send u my code if u can help me fix it

native harness
#

send it

drifting arrow
#

Felt like a threat.

slate swan
#

no

drifting arrow
#

K send code

visual island
#

you dont need to send your code. The error means that you triggered the command but didn't pass a required argument

slate swan
#

ok

drifting arrow
#

Not to my dms @slate swan

#

here.

slim gust
#

hey

drifting arrow
#

hi @slim gust

slim gust
#

sm1 has free discord bot code?

slate swan
#

i send u it in dms cause i dont want everyone to see my code

drifting arrow
#

@slim gust lol

#

While I'm open to sharing code. Not like that tho.

lament mesa
#

!src

unkempt canyonBOT
slate swan
drifting arrow
#

@slate swan just send it here. they dont care that it's about roblox

slate swan
#

send what?

drifting arrow
#

Your code..

visual island
#

you just... Need to specific the argument when invoking the command

drifting arrow
#

Remove any sensitive information and send. honest, the people who are gonna help you wont care what it's about. and those who do want roblox code will do it themselves.

unkempt canyonBOT
#

Hey @slate swan!

Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:

• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)

• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:

https://paste.pythondiscord.com

slate swan
#

here my code

visual island
#

like !check @user you specified the first arg

hasty iron
#

also you should use aiohttp

trail breach
#

id = client.get_guild(ID)

#

this gets the channel id wherever a message appears?

drifting arrow
visual island
#

depends on where you put it

trail breach
drifting arrow
#

guild = discord server

trail breach
#
@client.event
async def on_message(message):
    id = client.get_guild(ID)
    channels = ["commands"]

    if str(message.channel) in channels: # Check if in correct channel
        if message.content.find("!hello") != -1:
            await message.channel.send("Hi")
        elif message.content == "!users":
            await message.channel.send(f"""# of Members: {id.member_count}""")```
visual island
#

then yes it gets the guild id everytime a message appears

trail breach
#

guild is server?

visual island
#

yes

drifting arrow
#

While discords naming conventions make actual sense. since there's no introduction to discord, people don't use the proper terminology

#

and thus it can get confusing at times

#

oh

trail breach
#

@client.event and @client.listen("on message") are the same??

visual island
#

not really

jade jolt
#

one overrides process_commands, one doesnt

visual island
#

.listen can be used multiple times within the same event, .event cant

boreal ravine
trail breach
maiden fable
#

Kylee God Coder

surreal sierra
#

Hey, just wondering if you can have an if inside an elif? In my head I think it should work but when I am trying my code it doesn't really work.
I understand what I said can be a bit confusing so just tell me if you want to see the code to understand (it's a bit much code tho)

visual island
maiden fable
spring flax
#
x = 5
if x == 4:
  #code
elif x == 6:
  #code
else:
  #code
spring flax
maiden fable
jade jolt
#

i meant usage, but you get the point

spring flax
#

elif is short for else if

maiden fable
jade jolt
#

@bot.listen('on_message')

hasty iron
#

both are correct

jade jolt
#

you just did @bot.listen()

spring flax
#

and?

maiden fable
surreal sierra
maiden fable
spring flax
surreal sierra
spring flax
#

then with what are you not sure about elif?

#

oh

#

yes you can

visual island
#

huh, is this even dpy question potatothink

maiden fable
#

🤷

surreal sierra
spring flax
#

you saw nothing

surreal sierra
#

lol

jade jolt
#

i saw that

spring flax
#

!e

x = 5
y = 10
if x == 6:
  print("x was 6")
elif x ==5:
  if y == 10:
    print("x was 5 and y was 10")
unkempt canyonBOT
#

@spring flax :white_check_mark: Your eval job has completed with return code 0.

x was 5 and y was 10
spring flax
#

@surreal sierra ^

surreal sierra
#

Yeah, then I just don't understand why my script doesnt work like I want it

spring flax
surreal sierra
#

Okay thanks! I will do that

trail breach
#

any gud documentations

#

i hv been trying to find one

jade jolt
#

the official ones

lament mesa
#

docs for?

trail breach
#

i obv dont want to read the same things again but i dont know where to start in it

trail breach
lament mesa
ionic wadi
#

!codeblock

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

lament mesa
#

!d discord

unkempt canyonBOT
#

In order to work with the library and the Discord API in general, we must first create a Discord Bot account.

Creating a Bot account is a pretty straightforward process.

ionic wadi
#
@bot.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def hub(ctx):
    channel = bot.get_channel(885206406385524757)
    embed = discord.Embed(title="Command Log", description="Hub commando")
    embed.add_field(name="Author:", value=f"{ctx.author.mention}")
    embed.add_field(name="Bericht:", value=f"{ctx.message.content}")
    await channel.send(embed=embed)
    embed = discord.Embed(title="Hub informatie:", description="Zie hieronder de info.")
    results = requests.get('https://games.roblox.com/v1/games/2857480150/favorites/count').json()
    content = results[0]['favoritesCount']
    embed.add_field(name="Favorites:", value=content)
    embed.add_field(name="Link:", value="https://www.roblox.com/games/7322780412/Colza-productions-HUB")
    await ctx.send(embed=embed)```
#

I dont get an output or error

trail breach
jade jolt
#

hahahwhat

#

great docs! @lament mesa

trail breach
#

lmao

#

ya no i found the rest of it

lament mesa
trail breach
#

thanks

#

its divide into 3 docs

lament mesa
#

add a print statement and see if it gets printed

trail breach
#

whats the diff b/w client = discord.Client(), bot = coommands.Bot(command_prefix='$')

ionic wadi
lament mesa
#

maybe you have a on_message event

#

and didnt add process_commands

ionic wadi
#

I have It In an bot.listen

#

oh wait yeah I changed It today

slate swan
trail breach
ionic wadi
#

Oh wait File "/home/container/.local/lib/python3.9/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/container/bot.py", line 64, in on_ready
await bot.process_commands(message)
NameError: name 'message' is not defined

lament mesa
#

why do you have process commands in on_ready

ionic wadi
#

Oh wait

#

I only have an on_message_delete

jade jolt
#

👀 uh

ionic wadi
# lament mesa why do you have process commands in `on_ready`

@bot.event
async def on_message(message):
if message.content in blacklist:
await message.delete()
await message.author.send("Dit woord is geblacklist")
print(f"{message.author} heeft een geblacklist woord gestuurd")
await bot.process_commands(message)

slate swan
#

dm me if you can help me

lament mesa
#

did you save the file?

ionic wadi
#

Yes.

#

None of the commands are working now

slate swan
#

!d discord.on_message

unkempt canyonBOT
#

discord.on_message(message)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") is created and sent.

This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.

Warning

Your bot’s own messages and private messages are sent through this event. This can lead cases of ‘recursion’ depending on how your bot was programmed. If you want the bot to not reply to itself, consider checking the user IDs. Note that [`Bot`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot "discord.ext.commands.Bot") does not have this problem.
ionic wadi
#

Thats all the code

lament mesa
ionic wadi
lament mesa
ionic wadi
#

I cant sorry, Its teammade and I dont have perms to share all data

lament mesa
#

any errors?

ionic wadi
#

Nope, the hole output and terminals are empty

#

Im trying It without the on message event to make sure

#

Without on message It doesnt do anything either

trail breach
#

The first line : discord.py offers a lower level aspect on interacting with Discord what does this mean btw??

ionic wadi
lament mesa
#

yeah, its probably blocking everything

#

use aiohttp instead

ionic wadi
#

Idk If that api works with that

slate swan
#

dm me if you can help me

ionic wadi
#

!codeblock

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

ionic wadi
#
@bot.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def hub(ctx):
    responseees = requests.get('https://games.roblox.com/v1/games/2857480150/favorites/count').json()
    test = responseees[0]["favoritesCount"]
    embed = discord.Embed(title="Hub informatie:", description="Zie hieronder de info.")
    print(test)
    embed.add_field(name="Favorites:", value=test, inline=True)
    embed.add_field(name="Link:", value="https://www.roblox.com/games/7322780412/Colza-productions-HUB", inline=True)
    await ctx.send(embed=embed)```

This Is what I have now
drifting arrow
#

Why is everybody suddenly working with python?

drifting arrow
#

Wait

#

hold up. my stupidity is catching up again. I meant roblox

ionic wadi
#

Oh, I dont play It.

drifting arrow
#

Yeah that's it. roblox.

ionic wadi
#

I just get paid for the bots for them

drifting arrow
#

How? what? where? where can I go to get paid to make a bot for roblox

ionic wadi
#

Become dutch

#

and welcome to the rich life

#

peeps pay much here

drifting arrow
#

How are you advertising? 🤔

ionic wadi
#

12 euro for a basic mod bot without hosting

#

People come to me, I dont go to people

drifting arrow
#

and how do they find you

ionic wadi
#

Every bot Is another ad for me

#

If you have a bot developer rank In an server people will get interested

#

and remember you for If they get one

drifting arrow
#

@ionic wadi just tell me how to get started doing roblox stuff so I can earn money xD

hasty iron
#

be greedy

slate swan
ionic wadi
#

No

bitter depot
#

Can please get back on topic here

drifting arrow
#

Sorry @bitter depot lol

slate swan
#

oh alright 9ACOSP_pray get back on topic

exotic patrol
hasty iron
#

you should use aiohttp

#

requests is blocking

#

and name your variables better pls

ionic wadi
#

You have a form for me about that xd

slate swan
ionic wadi
#

Yeah I know

ionic wadi
slate swan
slate swan
ionic wadi
hasty iron
#

its porbably

#

a KeyError, or an IndexError

slate swan
#

maybe in the decorator

hasty iron
#

do you have an error handler

slate swan
#

let me see

ionic wadi
hasty iron
#

no

#

you should create a global session

slate swan
#

wait hes trying to use AIOHTTP ?

#

it would be responsees.json()

ionic wadi
hasty iron
#

like this

import aiohttp

bot = # bot definition

async def create_session():
  bot.session = aiohttp.ClientSession()

bot.loop.run_until_complete(create_session())
bot.run()
#

and then use bot.session

hasty iron
#

although its better to subclass cuz that way you can close the session

graceful gulch
#

just do it in ur on_ready func

hasty iron
hasty iron
slate swan
#

can someone help me?

ionic wadi
slate swan
hasty iron
#

exactly, we're creating the session that we're going to use to grab the data from the api

#

and inside a command it'll be

async with bot.session.request(*args, **kwargs) as response:
  ...
ionic wadi
hasty iron
#

doesnt matter, just have this bot.loop.run_until_complete(create_session()) above bot.run

slate swan
#

i used AioHttps to make some requests and i didnt use that.

#
class spin (commands.Cog):
    def __init__(self,bot) -> None:
        self.bot = bot
    @commands.command()
    async def spin(self,ctx,) -> str:
        global r
        lst = ['careful from hitting ur head while spining', 'spinned too fast that he traveled across the universe','spin spin spin']
        async with aiohttp.ClientSession() as session:
            async with session.get('https://kawaii.red/api/gif/spin/token=mycooltoken/') as r:
                if r.status == 200:
                    js = await r.json()
                    embed = discord.Embed(title=f'{random.choice(lst)}',description=f'{ctx.author.mention} IS SPINNING')
                    embed.set_image(url=js['response'])
                    await ctx.send(embed=embed)
                    await asyncio.sleep(4)
                    await ctx.message.delete()
    @spin.error
    async def spin_error(self,ctx,error):
        if r.status != 200:
            await ctx.send('the api is dead')
def setup(bot):
    bot.add_cog(spin(bot))
``` this was the code
graceful gulch
#

that can work as well

#

its better cause making a global session conflicts with the bot's session

slate swan
#

what would be the benefit of having
bot.loop.run_until_complete(create_session()) then ?

unkempt canyonBOT
#

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

ionic wadi
#
@bot.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def hub(ctx):
    response = requests.get('https://games.roblox.com/v1/games/2857480150/favorites/count').json()
    data = response[0]["favoritesCount"]
    async with bot.session.request(*args, **kwargs) as response:
        embed = discord.Embed(title="Hub informatie:", description="Zie hieronder de info.")
        print(data)
        embed.add_field(name="Favorites:", value=data, inline=True)
        embed.add_field(name="Link:", value="https://www.roblox.com/games/7322780412/Colza-productions-HUB", inline=True)
        await ctx.send(embed=embed)```
#

Would this do the job?

slate swan
#

i dont think.

hasty iron
#
    response = requests.get('https://games.roblox.com/v1/games/2857480150/favorites/count').json()
    data = response[0]["favoritesCount"]
``` this is not needed anymore
#

and replace *args and **kwargs with the arguments that you need

ionic wadi
#

ok

hasty iron
#

ok well

#

!d aiohttp.ClientSession.get

unkempt canyonBOT
#

coroutine async-with get(url, *, allow_redirects=True, **kwargs)```
Perform a `GET` request.

In order to modify inner `request` parameters, provide kwargs.
hasty iron
#

thats what you need, no clue why request doesnt have a link

ionic wadi
#

But how does It knw which link?

#

api

hasty iron
#

read the first argument

#

url

ionic wadi
#
@bot.command()
@commands.cooldown(1, 30, commands.BucketType.user)
async def hub(ctx):
    coroutine async-with get('https://games.roblox.com/v1/games/2857480150/favorites/count/', *, favoritesCount)
    async with bot.session.request(favoritesCount) as response:
        embed = discord.Embed(title="Hub informatie:", description="Zie hieronder de info.")
        print(data)
        embed.add_field(name="Favorites:", value=data, inline=True)
        embed.add_field(name="Link:", value="https://www.roblox.com/games/7322780412/Colza-productions-HUB", inline=True)
        await ctx.send(embed=embed)```
lament mesa
#

its not coroutine async-with

ionic wadi
boreal ravine
#

thats the reference

#

maybe it's async with aiohttp.ClientSession.get()?

lament mesa
#

yeah, and intialize ClientSession

ionic wadi
#

async def create_session():
bot.session = aiohttp.ClientSession()

#

I have this at the top

grim oar
#

so im trying to code a discord bot
so i have this line of code that says 'print('We have logged in as (0.user)
'.format(client))'
but then it says
file 'main.py', line 11
print(We have logged in as (0.user)
^
SyntaxError: EOL while scanning string literal
does anybody know how to fix this
it in python btw
ping me if u can
also im using replit if that makes a difference and im new to coding

ionic wadi
#

Note: Put a space at the beginning of the text so theres a space between username and text

grim oar
#

thx

stiff nexus
#
sum(1 for i in bot.walk_commands())
``` in this how can i check how many cmd can be used by the author?
hasty iron
#

check if Command.can_run

#

!d discord.ext.commands.Command.can_run

unkempt canyonBOT
#

await can_run(ctx)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Checks if the command can be executed by checking all the predicates inside the [`checks`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks") attribute. This also checks whether the command is disabled.

Changed in version 1.3: Checks whether the command is disabled or not
stiff nexus
#

umm

#
sum(1 for i in bot.walk_commands(await ctx.author.can_run(ctx)))
#

like this?

#

did not work

grim oar
#

print('!bot 1'" We have logged in as")(0.user)
'.format(client))

slate swan
#

it would error

slate swan
#

also it's recommended to use fstrings instead

boreal ravine
slate swan
#

^

boreal ravine
#

Obviously you forgot a parentheses

slate swan
#

^

visual island
#
sum(i.can_run(ctx) for i in bot.walk_commands())
#

wait, walk_commands is a thing of bot?

#

I thought it was cog

stiff nexus
maiden fable
unkempt canyonBOT
#

for ... in walk_commands()```
An iterator that recursively walks through all commands and subcommands.

Changed in version 1.4: Duplicates due to aliases are no longer returned
visual island
lofty mulch
#

By the way, is there a less time-consuming way to restart the whole bot?

#

It's kind of a pain to restart Vscode everytime I want to restart my bot

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message

woeful fable
#

how do i go on about passing my message from main.py here
@client.event async def on_message(message): print(message.content) usermessage = message.content return usermessage

#

to my learn.py here
`def mainlearn():
dictionaryFile, inputFile = readArguments()
dictionary = loadDictionary(dictionaryFile)

if inputFile == "":
#interactive mode
while True:
userInput = usermessage
if userInput == "":
break
dictionary = learn(dictionary, userInput)
updateFile(dictionaryFile, dictionary)
print("learnt")
else:
print("not implemented")`

stiff nexus
#

how do i do view=view(ctx) in on_message_edit

maiden fable
#

What do you want to do?

#

Just do something like this

view = View(ctx) 
await send(view=view) 
stiff nexus
#

i want to know how to add a view button to on_message_edit event

stiff nexus
hasty iron
#

use get_channel and then TextChannel.send

maiden fable
slate swan
maiden fable
#

Or u can do for before also

#

Same thing except the ID and the content

stiff nexus
#

ok

bright lagoon
#

!rule 1

unkempt canyonBOT
bright lagoon
#

!rule 2

unkempt canyonBOT
bright lagoon
#

!rule 3

unkempt canyonBOT
#

3. Respect staff members and listen to their instructions.

stiff nexus
#

-_-

maiden fable
#

@bright lagoon #bot-commands

#

Got ya covered

slate swan
#

can someone help me?

maiden fable
#

@stiff nexus 😂the redirect URI is damn good in the bot invite. GG

maiden fable
hasty iron
#

that works?

stiff nexus
#

thx

hasty iron
#

you're not supposed to do it like that

#

i feel like you're breaking some kind of thing

stiff nexus
#

like?

slate swan
hasty iron
#

and its also kind of annoying

#

you invite the bot and then an invite pops up

stiff nexus
#

are u talking to me?

hasty iron
#

yes?

maiden fable
stiff nexus
hasty iron
#

why

slate swan
hasty iron
#

just pass it in...?

#

when calling the command

maiden fable
#

Like, !kick will raise that error but !kick @gritty needle won't

slate swan
#

put in here?

hasty iron
#

what

slate swan
hasty iron
#

no, when invoking the command

stiff nexus
hasty iron
#

<prefix>check <cookie here or whatever> <user>

hasty iron
stiff nexus
#

-_-

#

it wont do something like you thought

zinc reef
#

is there a way to check if a PartialEmoji is usable by the bot? Or try to convert PartialEmoji to full Emoji?

hasty iron
#

!d discord.Emoji.is_usable

unkempt canyonBOT
#

is_usable()```
[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.9)"): Whether the bot can use this emoji.

New in version 1.3.
zinc reef
#

yes, but what about a PartialEmoji.

hasty iron
#

isnt partial emoji given when the bot cant see the emoji?

zinc reef
#

I'm constructing my PartialEmojis myself

hasty iron
#

okay then you should know

#

if they're usable or not

zinc reef
#

I kinda have a custom emoji hardcoded in my code, and when testing with my test bot it can't see that custom emoji

pliant gulch
#

If the partial emoji is not a unicode emoji, access the name attribute and pass that into Bot.get_emoji

#

If it returns anything but None the bot should be able to use it

lofty mulch
#

I don't want to reload the extension, I want to reload the bot

river walrus
#

Will do the same

#

Unless you wanna clear the cache

lofty mulch
#

I literally want to kill the bot

proud sierra
#

How do I make pagination out of this list with the emoji controlling feature? Like 20 elements of a list in 1 page of embed and 20 in other?

Code:

@bot.command()
async def page(ctx):
    lis = [1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]
    embed=discord.Embed(title="Pagination out of a list", description=f"{lis}", color=0xe7b913)
    await ctx.send(embed=embed)```
lofty mulch
#

And restart it

#

I don't want to reload the extensions, I want to literally restart the whole bot through killing it

#

While also clearing the cache, of course

fading harness
#

hi does digitalocean good for hosting discord bot? i got the github student pack and i am thinking that should i use replit, digitalocean or microsoft azure. which one of the three is the best?

#

is 100$ enough

reef shell
#

Digital Ocean expensive

#

Use galaxygate maybe

#

I've never used any of these tho

#

Can't compare

hasty iron
#

digitalocean is probably better

#

replit is a no go

fading harness
fading harness
fading harness
pliant gulch
#

I'd do digital ocean

#

Keep in mind the 100$ credit expires in 2 months iirc

pliant gulch
#

You will have to make the most of it, and expire as in the credits disappear

fading harness
#

my breakfast cost me $1

#

i have $50000 a month

#

maybe a smart investing...

river walrus
#

Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message

proper umbra
#

hello

final iron
river walrus
#

Including me

lofty mulch
#

Does anyone here have any information about cogwatch?

slate swan
#

i want to DM a user when they join the server how do i do that

#

thanks