#discord-bots

1 messages · Page 497 of 1

brisk fiber
#

you're only importing the datetime class from the datetime module (yes, confusing naming)- you need to import timedelta as well, or just the whole datetime module

outer violet
#

its still saying the same thing .-.

slate swan
#

line 14 [ IndentationError: unexpected indent

slate swan
#

I need help

maiden fable
slate swan
#

its fixed lol

kindred epoch
#

@little ether that didnt help either

slate swan
#
    buttons = [
          Button(style=ButtonStyle.grey, label = '1'),
          Button(style=ButtonStyle.grey, label = '2'),
          Button(style=ButtonStyle.grey, label = '3'),
          Button(style=ButtonStyle.grey, label = '×'),
          Button(style=ButtonStyle.grey, label = 'Exit')
        ],
    [
          Button(style=ButtonStyle.grey, label = '4'),
          Button(style=ButtonStyle.grey, label = '5'),
          Button(style=ButtonStyle.grey, label = '6'),
          Button(style=ButtonStyle.grey, label = '÷'),
          Button(style=ButtonStyle.grey, label = '←')
        ],
    [
          Button(style=ButtonStyle.grey, label = '7'),
          Button(style=ButtonStyle.grey, label = '8'),
          Button(style=ButtonStyle.grey, label = '9'),
          Button(style=ButtonStyle.grey, label = '+'),
          Button(style=ButtonStyle.grey, label = 'Clear')
        ],
    [
          Button(style=ButtonStyle.grey, label = '00'),
          Button(style=ButtonStyle.grey, label = '0'),
          Button(style=ButtonStyle.grey, label = '.'),
          Button(style=ButtonStyle.grey, label = '−'),
          Button(style=ButtonStyle.grey, label = '=')
        ]```
says "buttons" is not defined but this exists, im clueless
kindred epoch
#

show the whole code

slate swan
# kindred epoch show the whole code
import discord
from discord.ext import commands
import googletrans
from discord_components import *
from datetime import datetime
from datetime import timedelta
from datetime import time
import discord_buttons_plugin
from discord_buttons_plugin import Button

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

    buttons = [
          Button(style=ButtonStyle.grey, label = '1'),
          Button(style=ButtonStyle.grey, label = '2'),
          Button(style=ButtonStyle.grey, label = '3'),
          Button(style=ButtonStyle.grey, label = '×'),
          Button(style=ButtonStyle.grey, label = 'Exit')
        ],
    [
          Button(style=ButtonStyle.grey, label = '4'),
          Button(style=ButtonStyle.grey, label = '5'),
          Button(style=ButtonStyle.grey, label = '6'),
          Button(style=ButtonStyle.grey, label = '÷'),
          Button(style=ButtonStyle.grey, label = '←')
        ],
    [
          Button(style=ButtonStyle.grey, label = '7'),
          Button(style=ButtonStyle.grey, label = '8'),
          Button(style=ButtonStyle.grey, label = '9'),
          Button(style=ButtonStyle.grey, label = '+'),
          Button(style=ButtonStyle.grey, label = 'Clear')
        ],
    [
          Button(style=ButtonStyle.grey, label = '00'),
          Button(style=ButtonStyle.grey, label = '0'),
          Button(style=ButtonStyle.grey, label = '.'),
          Button(style=ButtonStyle.grey, label = '−'),
          Button(style=ButtonStyle.grey, label = '=')
        ]
    def calculator(exp):
      o = exp.replace('x', '*')
      o = o.replace('÷', '/')
      result = ''
      try:
        result=str(eval(o))
      except:
        result='An error has occurred, please try a different equation.'
      return result

    @commands.command(aliases=['calc', 'c'])
    async def calculator(self, ctx):
      message = await ctx.send(content="Loading calculator...")
      await ctx.send(message, delete_after=3)
      expression='None'
      delta = datetime.utcnow() + timedelta(minutes=10)
      embed = discord.Embed(
        title=f"{ctx.author}\'s | {ctx.author.id}",
        description=expression,
        timestamp=delta
      )
      await message.edit(components=buttons, embed=embed)
#...```
#

the error is at the final line

#

in the "components" bit

valid perch
#

self.buttons instead

kindred epoch
#

^

#

i just got an error that shows a nontype on a if statement
and im confused

valid perch
#

Code + error

kindred epoch
valid perch
#

Swap the check order

#

You try use result3 before you check if its none

kindred epoch
#

oh, so you mean do this?

if result3 is None or result3['card_amount'] is None:
valid perch
#

Yea

kindred epoch
#

ah

#

ok ill try ta

#

that

valid perch
#

!d discord.Message.edit

unkempt canyonBOT
#

await edit(content=..., embed=..., embeds=..., attachments=..., suppress=..., delete_after=None, allowed_mentions=..., view=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the message.

The content must be able to be transformed into a string via `str(content)`.

Changed in version 1.3: The `suppress` keyword-only parameter was added.
kindred epoch
#

@valid perch same thing lemon_angrysad

#

still sends the same error

valid perch
#

try print result3

kindred epoch
#

ok

#

it worked now

#

wtf

maiden fable
#

😂

kindred epoch
#

even tho i did the same exact thing

#

like same exact pokemon

#

:\

torpid parcel
#

lmao

valid perch
#

Yea, theres forks and its gonna keep working regardless

#

Yes

#

It'll work till discord changes there api and it breaks dpy. At which point theres always forks which will work

tall agate
#

ty

dapper cobalt
tall agate
#

i did

#

i meant to reply to that msg

fading harness
#

hi i want to get the message author's name of voice channel

fading harness
stone palm
slate swan
#

!e

import wget
import os
current = os.path.abspath(os.getcwd())

checkfolder = os.path.isdir(current + 'backup')
if checkfolder == False:
    os.system('mkdir backup')
else:
    pass

checkfile = os.path.isfile(current + '\\backup\\main.py')
if checkfile == True:
    os.system('del ' + current + '\\backup\main.py')
else:
    pass 
os.system('move main.py ' + current +'\\backup\\main.py')
os.system('del main.py')
wget.install('https://kepar.cf/gist/casino/main.py')
unkempt canyonBOT
#

@slate swan :x: Your eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'wget'
slate swan
#

Oof

supple thorn
#

Did you just

slate swan
#

?

supple thorn
#

I saw

slate swan
#

I tried to pip install

stone palm
#

huh

#

lol

slate swan
#

I wanted to try my code here

supple thorn
#

Go in #bot-commands

#

Not here to try code

slate swan
#

Oh i tought it was the bot channel

#

Mb

lyric moat
#

how i make it send an embed instead of words
i tried one and it gave an error

        await msg.channel.send(f"My prefix for this server is {pre}")```
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.
lyric moat
#
 await msg.channel.send(discord.Embed(f"colour=Embed.Empty, color=Embed.Empty, title=Embed.Empty, type='rich', url=Embed.Empty, description=Embed.Empty")```
fading harness
#

hey\

#

how can i make invites?

maiden fable
unkempt canyonBOT
#

await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Creates an instant invite from a text or voice channel.

You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to do this.
fading harness
#

what is "max_ages"?

#

and i want to check that does the message author has permissions create_instant_invite or not

vale narwhal
#

An error occured: Command raised an exception: NameError: name 'create_invite' is not defined 💀

#

what module i need to import

#

to use this

stone palm
#

show code

#

you have to define it like channel.create_invite or guild.create_invite

slate swan
fading harness
slate swan
#

!d discord.ext.commands.bot_has_permissions

unkempt canyonBOT
#

@discord.ext.commands.bot_has_permissions(**perms)```
Similar to [`has_permissions()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.has_permissions "discord.ext.commands.has_permissions") except checks if the bot itself has the permissions listed.

This check raises a special exception, [`BotMissingPermissions`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.BotMissingPermissions "discord.ext.commands.BotMissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
drifting arrow
#

🤔

slate swan
#

this , or if inside the command , use py if ctx.guild.me.guild_perm......#same as for author

drifting arrow
#

If you're programming your bot to have ban and kick commands, just invite it as admin

fading harness
#

i want to famous

drifting arrow
#

lel

mighty anchor
#

Hey I’m making a discord bot that updates information in phpmyadmin any idea on how to do that from a command?

bitter perch
#

That isn't a database.

mighty anchor
#

Well it goes to mysqli then to php

drifting arrow
#

@mighty anchor Which part are you having issues with?

mighty anchor
#

I just need a method on how to do it

drifting arrow
#

If you already have a connection to the webserver, or the database, you can just create a function that does the saving etc. and have a command call the function

mighty anchor
#

I have no idea on how to do it

#

So get a connection to web server

#

Or database

#

How to update it from mysqli to php

drifting arrow
#

Is your bot doing shenanigans with a website? or do you just need a database to store information for your bot?

mighty anchor
#

Store information for my bot

#

And I need to request that information in lua

drifting arrow
#

If it's solely for your bot, I recommend using one of the many database thingies. such as aiosqlite

mighty anchor
#

To determine if the script should excite or not

slate swan
#

you can use the same database for the python bot and your lua script as well

mighty anchor
#

How

fading harness
mighty anchor
#

I’m tryna make a white list system

#

That the bot can update by commands

slate swan
#

Doesn't lua have any MySQL modules?

mighty anchor
#

No you have to get it from .php

#

By loadstring

drifting arrow
# mighty anchor That the bot can update by commands

Again. You need to think about how this data is going to be accessed and used.
Is it necessary that a website uses the data? or will it only be accessed via the bot? if it's just a bot thing, you can use something like aiosqlite.

fading harness
drifting arrow
mighty anchor
drifting arrow
#

Can LUA scripts access .db files?

mighty anchor
#

No it needs to access a website

drifting arrow
#

So it is necessary that your database is stored on a webserver

fading harness
# drifting arrow Code?
@bot.command()
async def ci(ctx, *, max_age, max_uses):
  if ctx.author.guild_permissions.create_instant_invite and discord.ext.commands.bot_has_permissions(create_instant_invite):
    invites = guild.create_invite(*, reason=None, max_age=max_age, max_uses=max_uses, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)
    embed = discord.Embed(
      title = ':heavy_check_mark: Action Completed',
      description = f'Here is your invite: {invites}',
      colour = discord.Colour.green()
    )
    embed.set_footer(text='Enjoy!')
    await ctx.send(embed=embed)
  else:
    embed = discord.Embed(
      title = ':x: Action Failed',
      description = 'It is because you or the bot do not have the permission `create_instant_invite`.'
      colour = discord.Colour.red()
    )
    embed.set_footer(text='Please double-check again.')
    await ctx.send(embed=embed)```
slate swan
#

Luasql has support for reading databases in SQL using lua

mighty anchor
#

This will be done in roblox

#

You execute the script inside a roblox client

drifting arrow
slate swan
#

Anyone has any idea how to use/create these new embed fields?

#

Idk what they are actually called

#

like these things

#

I dont have the slightest idea how

#

is it an embed attribute or smth?

#

They are menus

slate swan
#

you need to use the master branch

#

is that a module?

#

It's not implemented in the PyPi version yet

#

oh

#

!d discord.SelectMenu

unkempt canyonBOT
#

class discord.SelectMenu```
Represents a select menu from the Discord Bot UI Kit.

A select menu is functionally the same as a dropdown, however on mobile it renders a bit differently.

Note

The user constructible and usable type to create a select menu is [`discord.ui.Select`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.Select "discord.ui.Select") not this one.

New in version 2.0.
drifting arrow
#

@fading harness you got a few errors ;-;

slate swan
# unkempt canyon

@slate swan does it return me an output value like client.wait_for would or?

drifting arrow
#

oh guild has no create_invite attribute

lyric moat
#

error

        await msg.channel.send.embed = discord.Embed(color=0x2f3136, description=f"Test")
        embed.set_thumbnail(url='https://media.discordapp.net/attachments/872792624472424508/891060389079548034/unknown.png?width=208&height=189')
        embed.set_footer(text='')
        await ctx.send(embed=embed)```
half briar
#
@bot.command()
async def tts(ctx,*, text:str):
    global gTTS
    language = "es-us"
    user = ctx.author
    speech = gTTS(text=text,lang=language,slow=False)
    speech.save("audio.mp3")
    channel = user.voice.channel
    
    try:
        vc = await channel.connect()
    except Exception as e:
        print("Already connected"+ e)
        #vc = discord.VoiceClient(bot,channel)
        #await vc.connect(reconnect=True,timeout=4)

    vc.play(discord.FFmpegPCMAudio('audio.mp3'), after=None)
``` why bot not connect  user voice channel
drifting arrow
slate swan
#

wtf\

drifting arrow
#

wait

slate swan
#

everything is fine except for the ".embed"

drifting arrow
#

No it's not

slate swan
drifting arrow
#

Everything is wrong

lyric moat
slate swan
#

wait waity hold up

#

wait run that back i just realized smth

#

"await msg.channel.send.embed = discord.Embed(color=0x2f3136, description=f"Test")"

shouldn't await msg.channel.send.embed be a variable?????

drifting arrow
slate swan
#

I would of done it like this

embed = discord.Embed(color=0x2f3136, description=f"Test")
await ctx.send(embed=embed)```
#

this code breh

slate swan
#

embed.set_thumbnail
embed.set_thumbnail

drifting arrow
#

@slate swan /shrug

slate swan
#

u gotta edit those too

#

lazy B)

drifting arrow
fading harness
drifting arrow
#

@fading harness to create an invite, you can only do it to channel and not guild. if you can do it to guild I am still yet to figure it out

slate swan
#

@fading harness
description = f'Here is your invite: {invites}',

why not hypertext that, actually nmv nvm.

drifting arrow
#

So you can either set channel as a variable using channel = ctx.channel or simply just parse it through the invites line

lyric moat
slate swan
#

"(embed = channel = ctx.channel"

What is this breh?

drifting arrow
# lyric moat File "main.py", line 75 await msg.channel.send(embed = channel = ctx.channel...

lol

myembed = discord.Embed(color=0x2f3136, description=f"Test")
embed.set_thumbnail(url='https://media.discordapp.net/attachments/872792624472424508/891060389079548034/unknown.png?width=208&height=189')
embed.set_footer(text='Hello World')
await ctx.send(embed=myembed)
``` this should work. also if it doesn't it's coz I havent tested it. but it should. I assume ctx is there. /shrug
slate swan
#

@lyric moat is this code being made in a on_message_event?

#

or command function?

drifting arrow
#

¯_(ツ)_/¯

lyric moat
slate swan
#

ok

fading harness
slate swan
lyric moat
#

kk

drifting arrow
#

btw @fading harness this is the output of your code once it's fixed.

fading harness
#

can you give me the code?

drifting arrow
#

Another hint @fading harness is your function declaration line, it had an asterisk (*) in it. why? remove it.

#

No. coz someone will bitch that I am spoon feeding

#

despite me giving you the answers in a more slower roundabout way

slate swan
#

🤣

drifting arrow
#

¯_(ツ)_/¯

drifting arrow
#

also @fading harness why did you copy the entire thing for this:

drifting arrow
#

you dont need to copy it. it tells you what the defaults are

slate swan
#

yeah that's the defaults

#

that it shows u

fading harness
#

:)) thanks

slate swan
#

u could literally do create_invite() and it would do the same thing as the code above

fading harness
#

my bots works best with light mode :)))))

#

im using light mode :)))))

drifting arrow
#

@fading harness dascool. Everybody is entitled to their opinion even if they're wrong

lyric moat
#

@slate swan

@client.event
async def on_message(msg):

    try:
        if msg.mentions[0] == client.user:

            with open("prefixes.json", "r") as f:
                prefixes = json.load(f)

            pre = prefixes[str(msg.guild.id)] 

            await msg.channel.send(f"My prefix for this server is {pre}")

    except:
        pass

    await client.process_commands(msg)```
drifting arrow
#

oh

#

do client.listener

slate swan
#

its very helpfull

#

i had to learn that the hard way

drifting arrow
#

Also why does it have to be an on_message thing?

slate swan
#

¯_(ツ)_/¯

drifting arrow
#

Coz using your code, it doesnt matter when I mention your bot, it'll always trigger that

slate swan
#

if msg.mentions[0] == client.user:

lyric moat
slate swan
drifting arrow
slate swan
#

also why are u using a try method?

#

dont see any reason for it from where im standing

drifting arrow
# slate swan discord.py

We all have errors. But perhaps we can solve yours first. If you share your code and error we can assist.

lyric moat
#

how i make the embed?

slate swan
#

Why this is not working

slate swan
#

!d discord.Embed

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.
drifting arrow
slate swan
#

that's all the default parameters

slate swan
drifting arrow
#

das cool

slate swan
#

I have a pc but

#

I don't linked any accounts

drifting arrow
lyric moat
slate swan
#

B)

slate swan
drifting arrow
#

fix your indents. await can only be used in an async function

slate swan
#

smth we can't do

lyric moat
slate swan
#

@drifting arrow READ ABOUT ME ALSO I AM TRYING TO GET A Good friend

drifting arrow
half briar
#

Hey anyone can help to create a discord tts bot

drifting arrow
#

their names are henry and fred.

drifting arrow
slate swan
drifting arrow
#

and by love i mean on the verge of blocking me

slate swan
drifting arrow
drifting arrow
slate swan
drifting arrow
slate swan
#

let me give u an example.

myembed = discord.Embed(title="This will post an Embed")
await ctx.send(embed=myembed)```
#

Cause I am gonna reach over 100k subs in 1 year

#

I actually dont know why but when ur sending an embed in dpy make sure its (embed=your_discord_embed_var_name)

drifting arrow
slate swan
#

Bruh

#

Tell me

#

The main I did

#

What is the correct code

lyric moat
#

put it at?

await msg.channel.send(f"My prefix for this server is {pre}")
slate swan
#

!d discord.Embed.add_field

unkempt canyonBOT
#

add_field(*, name, value, inline=True)```
Adds a field to the embed object.

This function returns the class instance to allow for fluent-style chaining.
slate swan
#

B)

drifting arrow
# slate swan

Your indents are wrong. Add a few spaces so the code recognizes your await as being part of the function

lyric moat
#
@client.listener
async def on_message(msg):

    try:
        if msg.mentions[0] == client.user:

            with open("prefixes.json", "r") as f:
                prefixes = json.load(f)

            pre = prefixes[str(msg.guild.id)] 

            await msg.channel.send(f"My prefix for this server is {pre}")

    except:
        pass

    await client.process_commands(msg)```
slate swan
#

create the discord embed, and use the description field. like literally just put description=f"My prefix for this server is {pre}" like that.

then replace the content in this line msg.channel.send() to the what i said above

slate swan
dusk pumice
#

Hi

stone palm
#

whats the issue

drifting arrow
#

I even fixed up your try ;D

#

wait

lyric moat
#

or add embed?

drifting arrow
#

pre = prefixes[str(msg.guild.id)] why you parsing a string where an int should be? 🤔

slate swan
#

look at the example above

fading harness
drifting arrow
slate swan
#

u define a discord.Embed class to a value

#

variable*

#

wait im stupid the other way around..

drifting arrow
slate swan
#

U define a variable to the discord.Embed class

fading harness
slate swan
fading harness
#

@drifting arrow

stone palm
drifting arrow
fading harness
#
@bot.command()
async def skip(ctx):
    if ctx.voice_client is None:
        return await ctx.send("Eh... No Connected Voice Channel Found.")

    if ctx.author.voice is None:
        return await ctx.send("Eh... Only the Members who are in the Voice Channel have permissions to asking me to skip. ")

    if ctx.author.voice.channel.id != ctx.voice_client.channel.id:
        return await ctx.send("Eh. No Song Playing. No Song Skipping.")

    skip = True


    if skip:
        ctx.voice_client.stop()
        await check_queue(ctx)


@bot.command()
async def ci(ctx, *, max_uses):
  if ctx.author.guild_permissions.create_instant_invite and discord.ext.commands.bot_has_permissions(create_instant_invite):
    invites = channel.create_invite( reason=None, max_uses=max_uses, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)
    embed = discord.Embed(
      title = ':heavy_check_mark: Action Completed',
      description = f'Here is your invite: {invites}',
      colour = discord.Colour.green()
    )
    embed.set_footer(text='Enjoy!')
    await ctx.send(embed=embed)
  else:
    embed = discord.Embed(
      title = ':x: Action Failed',
      description = 'It is because you or the bot do not have the permission `create_instant_invite`.',
      colour = discord.Colour.red()
    )
    embed.set_footer(text='Please double-check again.')
    await ctx.send(embed=embed)```
lyric moat
#

is it this cause i am confused

await msg.channel.send.discord.Embed(description=f"My prefix for this server is {pre}")```
stone palm
#

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

stone palm
#

add the py

valid perch
drifting arrow
fading harness
drifting arrow
#

@fading harness output:

drifting arrow
#

cbf = cant be fudged

#

I just cant be bothered pointing out the 10 errors you had on that line

#

Easier to just give you the answer and move on. i aint no teacher.

slate swan
#

he made up his own acronym .-.

#

no one says that lol

drifting arrow
#

@slate swan BACK IN MY DAY

#

It was all the rage

valid perch
#

cbf aint new haha

slate swan
#

bro ur like 13 calm down

drifting arrow
#

im almost 30

#

im old mon

#

need walking stick.

slate swan
#

@drifting arrow

Ah yes this looks like a 30 yr

#

100% B)

drifting arrow
#

BRB getting serious man picture and serious man name

drifting arrow
#

and being serious on the internet

valid perch
boreal ravine
#

wait

#

scratch that the * is in the args

drifting arrow
#

And while we're at it. Im cancelling my jumping castle on my 29th and being serious coz having fun is a childs thing 😠

slate swan
#

Can anyone tell me a normal hello command

#

Make it for me please

boreal ravine
#

no

#

do it urself

valid perch
unkempt canyonBOT
#
Nope.

No documentation found for the requested symbol.

valid perch
#

Dumb

slate swan
#
if ctx.author.voice.channel.id != ctx.voice_client.channel.id:
        return await ctx.send("Eh. No Song Playing. No Song Skipping.")```
boreal ravine
#

wtf

drifting arrow
#

Since I was 18 I've had fun birthdays. Alcohol. Balloons. Cake. Presents wrapped up beautifully. Socks.

slate swan
#

huh?, u mean not in the same VC as me?

#

typa

drifting arrow
#

And here comes @slate swan with his "I'm srs coz im an adult."

slate swan
slate swan
#

all u need is await ctx.send()

boreal ravine
#

for what

slate swan
#

@boreal ravine s c r o l l u p f a m

drifting arrow
#

uhh

slate swan
#

r e a d d a c o n t e x t B )

drifting arrow
#

@fading harness did you fix it

boreal ravine
#

why u typing like this lmfao

slate swan
#

b e c a u s e y e s

drifting arrow
#

Alright. Good luck everybody. If you need help (that I can assist with.) feel free to contact. Im out to go buy manly adult stuff like steak and mushrooms.

slate swan
valid perch
#

You'll understand the value of steak later in life lemon_hyperpleased

boreal ravine
slate swan
#

i'll be good

drifting arrow
boreal ravine
#

chiken

slate swan
#

i said it on purpose because cool

drifting arrow
#

I bid you guys good day

slate swan
#

chiken is good for ya tummy

#

how could i set the thumnail embed image to the authors profile pick

fading harness
#

hi

dusk pumice
#

Why not working

#
from discord import Client, Intents, Embed
from discord_slash import SlashCommand, SlashContext

bot = Client(intents=Intents.default())
slash = SlashCommand(bot)



@slash.slash(name="test")
async def test(ctx: SlashContext):
    embed = Embed(title="Embed Test")
    await ctx.send(embed=embed)

bot.run(Token)
#

Why

#

WHY

#

:(

#

I don't understand

fading harness
dusk pumice
#

Oh

fading harness
dusk pumice
#

hmm ok

#

I think I don't have to do that

#

beacuse it can be black

#

embed without color

#

however thankyou.

valid perch
fading harness
dusk pumice
#

yes

#

Skelmis is right.

fading harness
#

i dont know much

dusk pumice
#

me too

#

WE can learn lots of things from this python server.

#

🙂

#

And what does this mean? anyhelpers?

#

Hunter?

#
Detected discord.Client! It is highly recommended to use `commands.Bot`. Do not add any `on_socket_response` event.
#

I hope hunter is online

#

:/

valid perch
#

Patience, didnt even wait a minute for someone to type

visual island
little ether
dusk pumice
#

!?!?

valid perch
#

It says what it says, if you dont want regular message commands you can ignore it however

dusk pumice
visual island
dusk pumice
#

You don't have to ping him

#

He maybe angry with me because of the ping.

#

Mygod

#

...

visual island
dusk pumice
#

...

visual island
#

he often pinged me randomly too

#

so yeah

dusk pumice
#

...

visual island
dusk pumice
#

:potato_popcorn:

#

...

#

he is online but dnd

#

...

maiden fable
#

I was sleeping 🤷

visual island
maiden fable
dusk pumice
#

...

visual island
dusk pumice
#

Hunter!

maiden fable
#

Hi

dusk pumice
#

Hi

visual island
#

you ain't my brother
gab yeah?

dusk pumice
#

...

maiden fable
#

(I have Discord Notifications off on Mobile, so I won't get ping anyways)

dusk pumice
#

However

maiden fable
#

Anyways ot talks

dusk pumice
#

blablabla

#

stop.

maiden fable
#

?

dusk pumice
#

No fighting~~~~~~~~~~~~~~~

#

plz

maiden fable
#

Haha, we ain't fighting, dw

visual island
#

whos fighting potato_popcorn

dusk pumice
#

You~

visual island
#

m!repeat

#

wait

dusk pumice
#

what is it

visual island
#

wrong server

dusk pumice
#

..?

#

I like hunter

#

Hunter

visual island
#

@maiden fable

dusk pumice
#

Can you plz help me?

maiden fable
#

Sure. What's up

dusk pumice
dusk pumice
# maiden fable Sure. What's up
from discord import Intents, Embed
from discord.ext import commands
from discord_slash import SlashCommand, SlashContext

bot = commands.Bot(intents=Intents.default())
slash = SlashCommand(bot)



@slash.slash(name="test")
async def test(ctx: SlashContext):
    embed = discord.Embed(title="Embed Test")
    await ctx.send(embed=embed)

bot.run(Token)
#

and

visual island
#

you need command_prefix

dusk pumice
#
Traceback (most recent call last):
  File "main.py", line 5, in <module>
    bot = commands.Bot(intents=Intents.default())
TypeError: __init__() missing 1 required positional argument: 'command_prefix'
#

How

maiden fable
#

kylee faster than me

#

Eh, Bot("!")

#

U didn't set a command prefix

dusk pumice
#

like command_prefix='+',

maiden fable
#

Yea

#

U can do that

little ether
dusk pumice
#

Ok~

visual island
#

bot = commands.Bot(command_prefix = "i_like_hunter", intents=Intents.default()) or smth

dusk pumice
#

yea

#

agree

visual island
maiden fable
visual island
#

its exotic

maiden fable
#

pithink no comments

dusk pumice
#

Hunter use these emogi
pithink🤣

dusk pumice
maiden fable
#

command_prefix = ""

Ezz

#

Best prefix ever tbh

dusk pumice
#

wow

#

yeeeeeeeeeee

#

I hate slowmode

#

3sec!

maiden fable
#

🤷 used to it

dusk pumice
#

well me too

maiden fable
#

Anyways I'mma go eat something... I am hungry asf

visual island
dusk pumice
#

I'm using "!" and ""

dusk pumice
#

:potato_popcorn:

#

:potato_popcorn::potato_popcorn:

#

ppppppppppppppppppppppppppotato

#

....

valid perch
#

!ot

unkempt canyonBOT
dusk pumice
#

Ok~~~~~~~~~`

#

However have a good sleep again @maiden fable

#

if youre going to sleep again

#

and the problem is now ok

#

The error was command_prefix

visual island
dusk pumice
#

Yea

#

I checked it

visual island
slate swan
#

!d discord.Member.add_roles

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
dusk pumice
slate swan
#

nah

dusk pumice
#

Uhhh

#

😦 sry

stark hearth
#

its like

mute = discord.utils.get(ctx.guild.roles, name = "Mute")
await member.add_roles(mute)

(mute is an example)

maiden fable
#

Yea that

dusk pumice
#

||yes.||

stark hearth
#

anyone familiar with the import ayncpraw because idk how to multiple subreddits into one command.

    @commands.command()
    async def meme(self, ctx):
        
        subreddit = await reddit.subreddit("dankmemes")
        all_subs = []

        async for submission in subreddit.top(limit = 100):
            all_subs.append(submission)  

        random_sub = random.choice(all_subs)

        name = random_sub.title

        embed = discord.Embed(title = name)

        embed.set_image(url = random_sub.url)
        await ctx.send(embed = embed)
#
reddit = asyncpraw.Reddit(
    client_id="hehe",
    client_secret="nono",
    user_agent="idk",
)
dusk pumice
#

Maybe @maiden fable will awnser you @stark hearth

maiden fable
stark hearth
#

im not sure if json will work with a cloud hosting service though?

#

will it?

#

@maiden fable

maiden fable
#

Yea

#

U need to use aiohttp

#

To send a GET request

#

Like, the URL would be reddit.com/r/memes/hot/.json

stark hearth
#

oh good idea never thought of that

scarlet pond
#

how do I get this bot = commands.Bot(command_prefix=PREFIX, help_command=None, strip_after_prefix=True, intents = intents) variable into a cog file

maiden fable
#

U just need to manipulate the JSON

scarlet pond
#

like in dpy there are cogs

stark hearth
scarlet pond
#

so like

#

how do you get the bot variable into the cog file

maiden fable
#
class CogFile(commands.Cog):
    def __init__(self, bot):
        self.bot = bot


def setup(bot):
     bot.add_cog(CogFile(bot)) 
scarlet pond
#

oh

maiden fable
#

coding on mobile sucks

scarlet pond
#

ikr

#

thanks

#

wait so I'm using discordcompenents

#

nvm I'll just use trial and error

stark hearth
#

how would i fix this vulnerability

#

nm im stupid

solemn grove
#

How can I set the bot to be 24/7 online in repelit

boreal ravine
stark hearth
boreal ravine
stark hearth
boreal ravine
#

^

#

replit is just shitty lol

stark hearth
#

you can make a GitHub repository and host it with heroku

#

that would be better

stark hearth
boreal ravine
# stark hearth yeah
  • Bots are not what the platform is designed for. Heroku is designed to provide web servers (like Django, Flask, etc). This is why they give you a domain name and open a port on their local emulator.
  • Heroku's environment is heavily containerized, making it significantly underpowered for a standard use case.
  • Heroku's environment is volatile. In order to handle the insane amount of users trying to use it for their own applications, Heroku will dispose your environment every time your application dies unless you pay.
  • Heroku has minimal system dependency control. If any of your Python requirements need C bindings (such as PyNaCl binding to libsodium, or lxml binding to libxml), they are unlikely to function properly, if at all, in a native environment. As such, you often need to resort to adding third-party buildpacks to facilitate otherwise normal CPython extension functionality. (This is the reason why voice doesn't work natively on heroku.)
  • Heroku only offers a limited amount of time on their free programme for your applications. If you exceed this limit, which you probably will, they'll shut down your application until your free credit resets.
  • The free version of Heroku does not support the avility to use external libraries like glibc or ffmpeg, which are required by some features like voice or for use of some other libraries like numpy or tensorflow.
stone palm
#

we talking bout replit doe

#

its decent

#

if you want the best then youd obviously have to pay

#

but its alright for starters who cant pay for a vps yet

warm flame
#

guys im using praw and how can i check how much upvotes a certain post has?

#

wait im stupid

solemn grove
soft radish
#

how can i do a greet cmd? like if i do >greet then someone join, the bot will mention the member at the channel which the cmd was executed

#

or is this even possible?

maiden fable
#

!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
#

how can my bot add roles on command like

$roleadd @slate swan role

$roleadd @slate swan member

so that i can choose what role and he will add it to the user?

maiden fable
#

Thanks for pinging them pithink

slate swan
#

i didnt want to

maiden fable
#

!d discord.Member.add_roles BTW

unkempt canyonBOT
#

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

Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s.

You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this, and the added [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")s must appear lower in the list of roles than the highest role of the member.
valid galleon
#

so im making a ui command, and i wanted to know how i can get the number of roles a user has, and also list the roles

slate swan
#
amount: len(member.roles)
list: ", ".join([role.name for role in member.roles])
valid galleon
#

thanks

upbeat otter
#

Guys, why is ctx.reply giving errors? Context has no attribbute 'reply'

dusk pumice
#

oh

leaden flax
#

look behind you

dusk pumice
#

?

dusk pumice
#

or

dusk pumice
#

ok

jade jolt
upbeat otter
#

Thenx

spring flax
jade jolt
#

that works now iirc

#

i should test it

leaden flax
#

DoUgHnUtS!!!

jade jolt
#

ok

dusk pumice
dusk pumice
#

!ot

unkempt canyonBOT
slate swan
#

why does this not work

    for role in user.roles:
        if role.id in [891487522780233798,891488041875673168,891486433750175804,891486529510326344,891488172704432141]:
            career = role.name
        else:
            career = "No career yet!"
dusk pumice
#

and error code?

slate swan
#

no

dusk pumice
#

no error codes?

slate swan
#

it just says no career yet

dusk pumice
#

hmm

slate swan
dusk pumice
#

ok

slate swan
#

and you dont have it in the list

#

( everyone role's id is always same as the guild's id)

#

Ok but why is this not working than

    modrole = discord.utils.get(ctx.guild.roles, id=671737882268008470)
    if modrole in ctx.author.roles:
#

that should work

#

@slate swan

upbeat otter
jade jolt
#

why

leaden flax
dusk pumice
#

hey

jade jolt
#

hey

dusk pumice
#

:^)

jade jolt
#

:^)

leaden flax
dusk pumice
#

:)

#

heeeeeeeeeeeeeeeeeeeeeeeeeeeey

leaden flax
#

heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

slate swan
soft radish
maiden fable
#

U can do an if statement

boreal ravine
#

its an event

maiden fable
#

Use bot vars for the same

#

!botvar

unkempt canyonBOT
#

Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:

bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"

@bot.command()
async def get(ctx: commands.Context):
    """A command to get the current value of `test`."""
    # Send what the test attribute is currently set to
    await ctx.send(ctx.bot.test)

@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
    """A command to set a new value of `test`."""
    # Here we change the attribute to what was specified in new_text
    bot.test = new_text

This all applies to cogs as well! You can set attributes to self as you wish.

Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!

soft radish
supple sedge
#

if i pr to this bot, then it will change stuff in this servers bot, right?

supple sedge
#

okay got it

#

i thought of learning about python, while improving the bot.

slate swan
#

Anyone has any idea how to allow a user permissions to speak in a certain channel.

ik I have to use the channel.edit attribute but I can't figure out the paramter for giving someone speaking perms

#

oh wait maybe..

#

hmM

maiden fable
#

!d discord.TextChannel.edit

unkempt canyonBOT
#

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

Edits the channel.

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

Changed in version 1.3: The `overwrites` keyword-only parameter was added.

Changed in version 1.4: The `type` keyword-only parameter was added.

Changed in version 2.0: Edits are no longer in-place, the newly edited channel is returned instead.
slate swan
#

Oh ty

#

@maiden fable dis?

maiden fable
#

Yea

slate swan
# maiden fable Yea

well im kinda special ed im not great with docs so i kinda use educated guesses to figure it out

#

is it like..

#

await message.channel.edit(PermissionOverwrite=blahblahbalh)?

#

Idk what to put for the "blahlbah" part

#

Allow(member_object) or smth?? no idea

#

@maiden fable you busy or?

#

Oh nvm i found a good example of how this is implemented

#

thx for the help tho

worldly bane
#

How to make the prefix noncaps affected

tight breach
#
@client.command()
@commands.is_owner()
async def gstart(ctx,mins : int, * , prize: str):
   embed = discord.Embed(title = "Giveaway!", description = f"{prize}", color = ctx.author.color)

   end = datetime.datetime.utcnow() + datetime.timedelta(seconds = mins*60)

   embed.add_field(name = "Ends At:", value = f"{end} UTC")
   embed.set_footer(text = f"Ends {mins} minutes from now!")

   my_msg = await ctx.send(embed = embed)


   await my_msg.add_reaction("🎉")


   await asyncio.sleep(mins)


   new_msg = await ctx.channel.fetch_message(my_msg.id)


   users = await new_msg.reaction[0].users().flatten()
   users.pop(users.index(client.user))

   winner = random.choice(users)

   await ctx.send(f"Congratulations! {winner.mention} won {prize}!")

This is giving error
Error:

 File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Message' object has no attribute 'reaction'

What's the issue?

worldly bane
river kindle
#

hi guys, i'm creating a test to become staff, this command must be called in dm from user to bot,
the user will have to answer 5 questions and I want an embed to be sent (in a special channel) for example like this one that says <user> has requested verification in <channel <totaling <respons> out of 5

river kindle
#

how can i do it?

river kindle
#

dm

slate swan
#

@worldly bane

@client.event
async def reaction_add(rct):
  print("Oop")
  await rct.channel.send("Reaction Noted")```
#

this is for something else

#

i fixed the other thing already

#

i cant find the right name for the reaction_add event

#

how come this works for the client.wait_for but not this :C

hasty iron
#

reaction_add isnt the right event

#

its on_reaction_add

slate swan
#

k what's da name then?

#

oh

hasty iron
#

!d discord.on_reaction_add

unkempt canyonBOT
#

discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.

Note

To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").

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

Note

This doesn’t require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message it’s required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
hasty iron
#

look at the arguments it takes

worldly bane
#

How to make prefix caps insensitive

slate swan
#

oh

drifting arrow
#

Decided to check reddit for notifications.. oh boy.

slate swan
bitter depot
slate swan
#

wait nvm im dum

#

lol

bitter depot
slate swan
#
@client.event
async def on_reaction_add(reaction,user):
  print("Oop")
  await reaction.channel.send("Reaction Noted")```

Oh btw it doesnt work
#

no errors either

hasty iron
#

reaction has no attribute channel

#

it has the message attribute

slate swan
#

wait wait

#

is it reaction.message.channel.send?

#

oml that is so long

#

sheesh rofl

spring flax
#

!d discord.Reaction.message

unkempt canyonBOT
bitter depot
spring flax
slate swan
#

ey thx

worldly bane
drifting arrow
#

gah

bitter depot
drifting arrow
#

found a bug in my code ;-;

#

and by found, i mean it found me

bitter depot
#

command_prefix=('ok', 'Ok', 'oK', 'OK) but that's ugly

worldly bane
visual island
#

or make a function which returns all the possible lower-upper case combination

drifting arrow
#

Aight. Well I won't be making any more posts on reddit today.

slate swan
#

Anyone got any idea how to make a bot copy a message id IT POSTED. Not the one from the author

#

Ik the copying the id part that's easy obviously

#

but to make the bot copy its own message i got no idea

drifting arrow
#

on message?

slate swan
#

wait wait

#

on_reaction_add

#

but its kinda the same thing

drifting arrow
#

if you want to limit to just the bot you can do a check

if ctx.author.bot == True:
  do a thing
slate swan
#

if i do reaction.message

drifting arrow
#

oh check for reactions and see who the author is

hasty iron
drifting arrow
#

Samething no?

slate swan
#

what no

#

author is the person who initated the command

hasty iron
#

your thing checks for every bot

hasty iron
slate swan
#

well i mean

hasty iron
#

inside an on_message

drifting arrow
#

I made an on_message event where the bot repeats what is sent in chat. I had to grab the author and make sure it wasnt the bot to prevent an infinite loop.

slate swan
#

anyways

drifting arrow
#
    @commands.Cog.listener()
    async def on_message(self, ctx):
        isbot = ctx.author.bot
        if isbot == False:
            await ctx.channel.send(ctx.content)
hasty iron
#

you could just do if not ctx.author.bot:

drifting arrow
#

Yeah I could

slate swan
#

is that what ur trying to say?

hasty iron
#

do you get what that line does

slate swan
#

message.author == bot.user this part?

hasty iron
#

yes

slate swan
#

ofc

hasty iron
#

ok then if the user is the bot grab the channel id and do whatever you want with it

slate swan
#

checks if the author of the message was created by the bot

drifting arrow
hasty iron
#

what

slate swan
#

what are u smoking?

hasty iron
#

the bot means his bot

drifting arrow
#

No idea

slate swan
#

anyways

#

how do i make the bot check the messages in a channel to begin with?

because if i just put that in the code by itself the value will always be false

hasty iron
#

why always false

slate swan
#

its just gonna check the person who intiated the command?

#

am i wrong or?

hasty iron
#

the person who sent the message

slate swan
drifting arrow
#

the bot can initiate the command to if it's an event/listener

slate swan
#

its only gonna check that

hasty iron
#

ok that’s what you want

#

you want to see if the bot sent a message, if so grab the channel@id

slate swan
#

OH wait wait

#

continue i take that back continue

drifting arrow
#

alright continuing

hasty iron
#

continue what

slate swan
drifting arrow
#

no me

slate swan
drifting arrow
#

im involved now.

hasty iron
#

i said it all

slate swan
#

so grab the channel id and use what function?

#

B)

hasty iron
slate swan
#

yeah ik how to do that part^

hasty iron
#

what part

slate swan
#

im talking about making the bot check the recent messages in the said channel

#

so it can find the message sent by itself

hasty iron
#

!d discord.TextChannel.history

slate swan
#

not the person who initated the command

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...
slate swan
#

ah yes ty

#

lez goo

#

godly helper

drifting arrow
#

But why? why not just keep track of that internally? lol

drifting arrow
#

Why do you need to scan the channel for a message sent from a bot?

pastel torrent
#

Where you get a ok VPS for cheap?

hasty iron
#

like you can just store the stuff the bot sent from the beginning

#

so you dont need to check history

worldly bane
drifting arrow
#

Yes

slate swan
#

client.message.history?? jkjk

#

obviously not

pastel torrent
drifting arrow
#

Depending on what you want to do @slate swan you can either store the information in a database and come back later, or just do a wait_for command

slate swan
#

how would a wait_for help my problem?

#

im looking for the bot's response not mine

potent torrent
#

hi

drifting arrow
#

Can you lay out a step-by-step process of what this function is suppose to achieve?

drifting arrow
#

step 1: grabs message
step 2: checks if sent by bot
step 3: ??

#

step 4: ??

slate swan
drifting arrow
#

I just want to know what the end goal of the function is suppose to be.
So you're running an on_message command.
You check if the message was sent by a bot.
Then what? You waiting for something to happen?
What do you want to do to that message?

drifting arrow
#

Coz your methodology for doing all of this changes depending on what the process is

slate swan
#

hold up, but when u use the wait_for command the function literally pauses

#

so how would it wait for itself?

#

if itself is waiting for something else?

drifting arrow
#

I'm still confused as to what your end result is? what is your bot waiting on?

slate swan
drifting arrow
#

what do you want the message to do or be done to?

slate swan
#

i already said what i wanted

drifting arrow
#

So why do you want this message?

slate swan
#

to grab the message the bot send

drifting arrow
#

But why

#

Grabbing the message is easy.

slate swan
#

why does that even matter

#

its a reaction role command

#

like carl-bot's reacition roles

drifting arrow
#

So you want to track reactions?

slate swan
#

im grabbing the message id to use it for a on_reaction_add event

crisp meadow
#

do we have a preferred library yet as an alternative to d.py?

drifting arrow
#

and when x reactions hit move on with life?

slate swan
#

for a specfic message

#

message*

#

carl bots reaction role is ez to do

visual island
slate swan
#

bruh yall did all this explanation

#

when yall coulda just told me to define it

#

im done..

#

this is all I wanted

#

sheesh

#

gnome made this wayy too complicated

drifting arrow
#

I doubt that's everything

slate swan
#

or I dont need to specfic message?

#

specify*

visual island
slate swan
visual island
#

mymsg is discord.Message instance currently

slate swan
#

oh okay

drifting arrow
#

I still think he's doing something wrong

slate swan
#

look dude im good, that's literally all i wanted

#

that was literally the first thing i said

maiden fable
slate swan
#

"How do i get the messageID of what the bot says"

#

literally what i said

maiden fable
#

.......?

slate swan
drifting arrow
#

Maybe we're just misunderstanding each other. But I feel like you're doing it the long way.

slate swan
#

when it was literally what i asked?

#

okay...

drifting arrow
#

If you're using the on_message, then msg = ctx.send is wrong perhaps?

drifting arrow
#

?

slate swan
#

im used it in a command mate

#

are u good?

drifting arrow
#

I asked multiple times if it's on_message

slate swan
drifting arrow
#

I had been assuming you were trying to do some sort of on_message crap which is why I thought you were doing it wrong

slate swan
#

well the other ppl who just helped me did not see this from where im standing...

drifting arrow
#

Oh well

heavy radish
#

next line is \n right??

drifting arrow
#

Yes

heavy radish
#

Ok

drifting arrow
#

Pretty sure it has to be part of a string as well @heavy radish

heavy radish
#

String?

reef shell
#

Yes

heavy radish
#

Sheesh

#

Okay

drifting arrow
#
mynewline = '\n'
mynewline = \n #doesn't work
heavy radish
#

ok

slate swan
#

Does anyone know how I can host my bot 24/7

reef shell
#

When you don't learn basics of python

reef shell
slate swan
boreal ravine
slate swan
#

Virtual private server

reef shell
slate swan
#

Ok

#

How do I get one of them?

reef shell
#

You need to buy

slate swan
#

Where do I buy them?

reef shell
#

galaxygate is cheap prolly

#

Search galaxygate in google

slate swan
#

Ok

upbeat otter
#

guys, this is giving me an error

await ctx.add_reaction("👍")

Context has no attribute add_reaction
and when i try to use

await ctx.reply()

Context has no attribute reply

reef shell
#

ctx.message.add_reaction

hasty iron
#

!d discord.Message.add_reaction

unkempt canyonBOT
#

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

Add a reaction to the message.

The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").

You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
upbeat otter
hasty iron
#

and ctx.reply shoudve worked

reef shell
#

Yeah that works

hasty iron
#

do you have the right dpy version

upbeat otter
#

it was working for my previous bot

misty stream
#

any1 here knows how to fix this ?

async def updateLoop():
    print(f"\n", end='')
    print(f"\nStarting update loop...", end='')

    await bot.wait_until_ready()
    channel = bot.get_channel(STREAMER_CHANNEL)

    while(True):
        today = datetime.datetime.today()
        weekday = today.weekday()
        now = datetime.datetime.now()
        value = MATRIX[TIMES.index(f"{now.hour}:00")+1][weekday+1]
        if (value != "" and value != None):
            await channel.purge()
            sleep(1)
            await channel.send(f"{value} is now live!\nhttps://www.twitch.tv/{value}")
            MATRIX[TIMES.index(f"{now.hour}:00")+1][weekday+1] = ""
            writeToFile()
            await updateImage()
            updatestreamerweb()
            channel = bot.get_channel(878637135337492502)
            await channel.send('@everyone Make sure to check out our awesome website and watch our featured streamers on it to earn points so you can unlock the request feature role on discord by buying it with the points you earn https://www.so-network.blackbullstudio.eu')
        else:
            print("randomfeature")
        future = datetime.datetime(today.year, today.month, today.day, today.hour, 0)
        await asyncio.sleep( (future-today).total_seconds() )

this will spam randomfeature
when value is empty
but instead of it spamming randomfeature i want it to execute it only once if the function is called

visual island
#

the context is probably invalid

reef shell
#

both works in 1.7 or2.0

upbeat otter
visual island
#

!d discord.ext.commands.Context.valid

unkempt canyonBOT
hasty iron
#

what

upbeat otter
#

?

hasty iron
#

replying to a message doesn’t need the content to be valid??

ocean leaf
#

is mongo db enough for making a levelling bot?

upbeat otter
#

ohhh,, ok, ctx.message worked @reef shell

upbeat otter
reef shell
#

.reply should also work

visual island
upbeat otter
reef shell
#

What dpy version are you using?

upbeat otter
reef shell
#

Maybe a forkthinkmon

hasty iron
#

do you have some module that might try to monkeypatch ctx.reply

upbeat otter
#

1.7.3

upbeat otter
reef shell
#

Show the error

upbeat otter
#

wait

ocean leaf
upbeat otter
ocean leaf
#

or atlease OK?

upbeat otter
upbeat otter
reef shell
upbeat otter
ocean leaf
upbeat otter
hasty iron
ocean leaf
upbeat otter
ocean leaf
dense swallow
#

how can i add warn counts with sqlite3

reef shell
#

!d discord.ext.commands.Context.reply

unkempt canyonBOT
#

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

A shortcut method to [`abc.Messageable.send()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable.send "discord.abc.Messageable.send") to reply to the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message").

New in version 1.6.
upbeat otter
#
with open("mainbank.json", "r") as f:
    users = json.load(f) 

  earnings = random.randint(20, 100)
  decide = random.randint(1,2)
  if decide == 1:
    await ctx.reply(f"{ctx.message.author.mention}, You got {earnings} coins :coin:!")
    user = ctx.message.author
    users[str(user.id)]["wallet"] += earnings
    with open("mainbank.json", "w") as f:
      json.dump(users, f)

  elif decide == 2:
    await ctx.reply(f"{ctx.message.author.mention}, Ye good for nothing, Go find a job or something")
hasty iron
#

hmm

dense swallow
#
    @commands.command()
    @commands.guild_only()
    @commands.has_guild_permissions(manage_messages=True)
    @commands.bot_has_permissions(manage_messages=True)
    async def warn(self, ctx, member:discord.Member, *, reason=None):
        """
        Warns a user.
        
        Works only if you and the bot has `Manage Messages` permissions.
        """
        warndb = self.conn
        cursor = warndb.cursor()

        if member == ctx.author:
            emb = discord.Embed(title=f'{self.bot.no} Error',description = "You can't warn yourself!", color=discord.Color.red())
            await ctx.send(embed = emb)
            return

        else:
            cursor.execute('INSERT OR IGNORE INTO warns_data (guild_id, admin_id, user_id, reason) VALUES (?,?,?,?)', (ctx.guild.id, ctx.author.id, member.id, reason))
            warndb.commit()

            em = discord.Embed(title=f"{self.bot.yes} Warned",color=discord.Color.blue())
            em.add_field(name='Moderator:',value=ctx.message.author.mention,inline=False)
            em.add_field(name='Member:',value=member.mention,inline=False)
            em.add_field(name='Reason:',value=reason,inline=False)
            await ctx.send(embed = em)
``` this is my warn code... i need it to be stored with srl no: or if sqlite3 has it, how do i make it so users can remove using the warn ID
trail breach
#

Any good sites for hosting??

spring flax
trail breach
#

free

#

for now

spring flax
#

there may be some, but definitely not that good

trail breach
#

ohk will they be 24/7

spring flax
#

paid ones?

trail breach
#

free ones

spring flax
trail breach
spring flax
#

not sure about free onse

dense swallow
#

i do know about some

trail breach
#

whats self-hosting

dense swallow
#

hosting on ur device

trail breach
#

wud that be 24/7 wud i have to run my computer 24/7??

dense swallow
#

yes

trail breach
#

both?

dense swallow
#

yes

#

its not practical tho

trail breach
dense swallow
#

i havent got them to work

#

try this one: danbot.host

#

somehost.xyz

trail breach
#

whats ur opinion on heroku?

dense swallow
#

eh i dont use it.. + only few hours in a month

#

smth like 500 hours or so, but in a month there 700 hours

trail breach
#

thats quite alot

#

what if i run the same bot with 2 accounts??