#discord-bots
1 messages Β· Page 654 of 1
Help translate the command
Wtf
omg krypton

Goddamnyou winrar if you say !ot
!ot
Off-topic channels
There are three off-topic channels:
β’ #ot2-never-nesterβs-nightmare
β’ #ot1-perplexing-regexing
β’ #ot0-psvmβs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
!ot
Off-topic channels
There are three off-topic channels:
β’ #ot2-never-nesterβs-nightmare
β’ #ot1-perplexing-regexing
β’ #ot0-psvmβs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
how to make a discord bot
there are some resources online
wait
Myxi why are you asking that question
can you link a tutorial
Wonder why π
ok
The official video for βNever Gonna Give You Upβ by Rick Astley
βNever Gonna Give You Upβ was a global smash on its release in July 1987, topping the charts in 25 countries including Rickβs native UK and the US Billboard Hot 100. It also won the Brit Award for Best single in 1988. Stock Aitken and Waterman wrote and produced the track which w...
this one
thanks
thankd π
me good
!ot
Off-topic channels
There are three off-topic channels:
β’ #ot2-never-nesterβs-nightmare
β’ #ot1-perplexing-regexing
β’ #ot0-psvmβs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
i-
soo i am trying to make a function which sends random 1 image out of 140 since github only accepts 100 i add 100 image in 1 folder and 40 in 2nd so i made dis but its only sending image from folder 1 not 2nd
number = random.randint(1, 99)
wow = random.randint(100, 140)
f = discord.File("./vote_rewards/reward "+ str(number)+".jpeg", filename="vote_rewards.jpeg", spoiler=False)
g = discord.File("./vote_rewards2/reward "+ str(wow)+".jpeg", filename="vote_rewards2.jpeg", spoiler=False)
embed = discord.Embed(title="Konichiwa Goushinjin-sama", description="**Arigcato Gosaimushta For Voting, Here Is Your Reward**", color=0xcf24ff)
embed.set_image(url="attachment://vote_rewards.jpeg" or "attachment://vote_rewards2.jpeg")
choices = (f,g)
random.choice(choices)
user = await bot.fetch_user(message.content)
print(f.fp)
await user.send(file=f, embed=embed)
good bye
.send(files=[f, g])
choices = [f, g] *
Also instead of using fetch_user do message.mentions[0], btw it'll also raise an IndexError if there's no mentions
If there is it'll return a Member | User object
?
??
I didn't say anything wrong
Also changing it from a tuple to a list won't do anything
They're both iterables
How do I check a member's role with the bot? (ping me)
Wym
!d discord.Member.roles ?
property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [β@everyone](mailto:'%40everyone)β role.
These roles are sorted by their position in the role hierarchy.
It will show everyrole
I want to show the main role
that they have
for example
?role @slate swan it should show Owner
!d discord.Member.top_role
property top_role: Role```
Returns the memberβs highest role.
This is useful for figuring where a member stands in the role hierarchy chain.
This?
Yes
Ah cool!
urgh
!d discord.Member.top_role *
property top_role: Role```
Returns the memberβs highest role.
This is useful for figuring where a member stands in the role hierarchy chain.
hey im trying to use sqlite and i think something doesnt work. The bot tells me the table im trying to open doesnt exist
nvm nvm, it works
do you like to be called carrot or Kraots
Well seems like a db bug, ig
how do i fix that
like is there any line of code that can check if anythings on there or something
Do u have SQLite DB Browser?
yeh
Try using that
yeah i mean theres a table but the bot doesnt see it for some reason
yeah i even deleted the DB and made it again and still doesnt see it, am I connecting to the wrong db or what
Can I see the query?
im dumb what is a query
my brain lagged
that would show the tables right?
wait no thats the
okay step by step tell me what to do lmao
yes
So the string inside it
cur.execute(f"SELECT user_id FROM rocks WHERE user_id = '{ctx.message.author.id}'")
okay cool
And rocks is the DB Name?
table?
Be sure since names are case sensitive iirc
Yea sorry table
I knew this was coming lmao
it had to
But since it's just author id, I don't think there's a problem, is it?
yes
???
it's not about what's in the variable
Then?
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: no such table: rocks well idk bro
noidea
The table name is case sensitive. Make sure the case is correct
actually it gave a syntax error
yes its all lowercase
Can ya show me in the SQLite Browser?
what code you used during CREATING table
wait a sec
Can someone help Iβm tryna make bot and is {member.guild} ok? And itβs not working
show your code
Ok
https://media.discordapp.net/attachments/782989062386352159/917054031258607636/91848bf05f5aecd0e3ba2d009f6962fa.png can you do something like that with dpy ?
@bot.command(aliases = ['is {member} ok?'])
async def ball(ctx): #can't really put numbers in the command name so we have 8ball as an alias instead
import random
ballresponses = ['Yes', 'No']
z = random.choice(ballresponses) #choose yes or no, randomly
okay now like everything broke lmao
well, in member is not defined, so it won't work
So what should I do?
{guild.member}?
just show the scrrenshot of the browser
i dont think that you can have dynamic command aliases
first lets adress why the code to create the DB broke now lmao
you can do it in the on_message event though
Ok
db = sqlite3.connect("main.sqlite")
cur = db.cursor()
cur.execute("""
CREATE TABLE IF NOT EXISTS rocks(
user_id TEXT,
mined INT
""")
db.commit()``` I get like incomplete input error lol
in the cur.execute
also its discord made it like this its all in one line
missing )
where is the 2nd bracket? like you miss-copied?
oooohhhh
and to create a table IF NOT EXSIST isnt needed
just
c.execute("""CREATE TABLE wala(
hm text
"""))
db.commit()```
oh i see
okay so whats the next problem?
Can someone in pm help me with fixing music bot so it plays soundcloud links?
oh also the DB is being created in the wrong folder
i expect it to create in the folder with the bot, it creates in the folder where the bot folder is
wait what? elaborate more
i have a python folder, and in the folder i have the bot folder
the file will be created where the code file it
so in the bot folder make a python file import sqlite3 and make the table
well i suggest making the user_id a sql bigint
the whole bot is in the folder
where you want the database file to be?
in the bot folder, and its in the python folder
so drag and drop
isnt it gonna create a new one
where is the coding file where you have used the codes too maake the db file?
let me say it as simple as I can
nope (dont think so anyways since danny would've implemented that with slash commands also)
!d disnake.ext.commands.Bot.user_command
@user_command(*args, **kwargs)```
A shortcut decorator that invokes [`user_command()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.user_command "disnake.ext.commands.user_command") and adds it to the internal command list.
I have a python folder with python stuff in it
I have a bot folder where im currently working, the bot folder is inside of the python folder
when i run the .py file that is inside of the BOT folder, the DB is made in the python folder
send screenshot
of the folders and the codes near the CREATE TABLE
how can I write lines on json file using dpy?
with open
MiningRPG is the bot folder, main.sqlite on the bottom is the DB made in the wrong folder
but do you have the doc?
My bot is sending 10 links to the 10 images it was supposed to send but only 5 of them are embedded. Is this because it's a bot account or is there something I need to code?
with open("hm.json" "r") as f:
f.dump(variable)```
i have used it
hm, ty
can someone help me w/ this
!indets
Indentation
Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.
Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.
Example
def foo():
bar = 'baz' # indented one level
if bar == 'baz':
print('ham') # indented two levels
return bar # indented one level
The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.
Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines
More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation
My bot is sending 10 links to the 10 images it was supposed to send but only 5 of them are embedded. Is this because it's a bot account or is there something I need to code?
show code, where you send it or all of it
hmmm this means you have i guess defined a file path in the code
and will the file save itself or does it need something else?
How to change pages instead of reply on buttons click
whatt
it will save itself
look at dis
https://stackoverflow.com/questions/19545734/create-a-sqlite3-database-in-a-directory-other-than-default
Change pages when buttons click not reply
by default sqlite makes the database in the path where the script is
so check the codes there must be a code where its defined a file path
a paginator?
if its not than make a file path in the script itself
huh ?
No
it's disnake, not discord.py
are those buttons?
yes
oh okay
For py?
wut
if you want they have a channel with recent questions you might find there
yes
bruh, no misleading
import discord
from discord.ext import commands
from discord_buttons_plugin import *
import os
client = commands.Bot(command_prefix=commands.when_mentioned_or(">"))
buttons = ButtonsClient(client)
@client.event
async def on_ready():
print(f"Logged in as {client.user.name}")
@client.command()
async def invite(ctx):
embed = discord.Embed(title=f"Invite {client.user.name}", color=0xff0000, description=f"Wanna invite {client.user.name}, then [click here](https://discord.com/api/oauth2/authorize?client_id={client.user.id}&permissions=8&scope=bot)")
await buttons.send(
content = None,
embed = embed,
channel = ctx.channel.id,
components = [
ActionRow([
Button(
style = ButtonType().Link,
label = "Invite",
url = f"https://discord.com/api/oauth2/authorize?client_id={client.user.id}&permissions=8&scope=bot"
)
])
]
)
@buttons.click
async def hibutton(ctx):
await ctx.reply(f"Hi {ctx.member.name}")
@buttons.click
async def clickbutton(ctx):
await ctx.reply(f"{ctx.member.name} has clicked the button.")
@buttons.click
async def danger(ctx):
await ctx.reply(f"{ctx.member}, told'ya not to click!")
@buttons.click
async def lol(ctx):
await ctx.reply("lol")
@client.command()
async def hi(ctx):
await buttons.send(
content="Hey there",
channel = ctx.channel.id,
components = [
ActionRow([
Button(
style = ButtonType().Primary,
label = "Hi",
custom_id = "hibutton",
),
Button(
style = ButtonType().Success,
label = "Click",
custom_id = "clickbutton"
),
Button(
style = ButtonType().Danger,
label = "Don't click",
custom_id = "danger",
),
Button(
style = ButtonType().Secondary,
label = "Hello",
custom_id = "lol",
)
])
]
)
client.run(os.getenv("token"))
@slate swan give linj
dm
use a discord.py fork or discord.py 2.0, not a third party lib
I made a dictionary with all the message attachments and then stored all of them in a variable, I know it seems like alot of work but I wasnt sure how else to do it
My question is on buttons click pages change not the bot msg reply
isn't it like
discord_components import buttons?
no, thats a third party lib
this is the code where it sends
what pages?
Uf
bruh stop
don't use third party libs, you either use discord.py 2.0 or a discord.py fork
discord.py doesnt have buttons man
they do man
my bot sends everything but the last 5 links just dont embed
!d discord.ui.Button <= yes man
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
since dpy wasnt having buttons people made discord_components the creator of buttons himself said
it did have buttons
in the master branch aka 2.0
guys i have a a question
we all do
do Member objects have a Member.is_bot attribute?
dont rly understand how this helps me
to check if the member is a bot
it does
π€¦
!d discord.Member.bot <= returns a bool
property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
in the stackoverflow it shows how to make a db in a specific location
so just add them in your script
ah yes, stackoverflow
no, you dont use the class, you dont use is_bot that isn't even a thing, read the embed the bot sent
Will that work with question like is {user} ok?
Answ= yes
k
ofc
basic OOP
@boreal ravine will it work with respond to question
does discord.Guild.get_member_named return a Member object?
user as in?
get_member_named doesn't even exist? where are you finding these attributes from
Will it work like = is @boreal ravine ok?
And it will answer yes @boreal ravine is ok
oh wait so i use db = sqlite3.connect("path/to/db.sqlite") ?
ig if you mean if the member is the bot, it'll return True everything else, False
i guess, try that
!d discord.Guild.get_member_named
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.
oh my bad then
will ./db.sqlite do the job?
ig, you could try that
cuz its in the current folder
So this wi work for me?
idk
Ok
try it
idk cuz usually it makes db in the script folder by default your scenario is diff
what i should do if i want to have buttons in one row?
it doesnt work
cant help then
My bot is sending 10 links to the 10 images it was supposed to send but only 5 of them are embedded. Is this because it's a bot account or is there something I need to code?
whyy doesnt it woooork
The other five links that it sends work they just don't embed so you just see the link
guys could you tell me please what i should do if i want to have buttons in one row?
https://cdn.discordapp.com/attachments/343944376055103488/917073971252449331/unknown.png
there are not nearby
is that discord py ?
My bot's about me does not show up for some reason. I have no idea why. I set the about me in the appilications page in the discord dev portral
i wanted to make a json like this:
{
email: <email typed by user>
password: <password typed by user>
}
``` and make the bot write the information into `alternatives_account.json`. how can i do it?
i really suggest a database
why use json to store those type of stuff
and hash the passwords
but it's just for testing
Hi Euclid
Thatβs what Iβm doing
π
yes but i want to learn read json file....
π¦
read the docs , not those tho
My bot about me is not showing up
I don't know why I put the about me on the discord developer portal and it was working fine before
Yeah and before I never even changed about me I just suddenly realized it was gone
I thought it might be because the bot says it's playing a game but other bots do that and it still shows their about me
And names
My profile picture and name stayed
I just don't know why the about me didn't
It just started working a few minutes later
I have no idea what happened
I got you here https://youtu.be/SPTfmiYiuok
Learn how to code a Discord bot using Python and host it for free in the cloud using Repl.it.
π¨Note: At 16:43, Replit now has a new method for environment variables. Check the docs: https://docs.replit.com/programming-ide/storing-sensitive-information-environment-variables
Along the way, you will learn to use Repl.it's built-in database and cr...



If you make a var that has the same name as a object it just makes a var right?
!ot
How do i define a link for a button with nextcord?
hi
Yeah first

BIRTHDAY BOI AKUMA????
Idk who's that ngl
With?
Who doesnt have akuma?
not discord bots
then
I asked in python general
no need to say !ot
user = await bot.get_user(493451846543998977)
if user == 493451846543998977:
await ctx.send("!ot")
I think this works
Just do
user = await bot.get_user(493451846543998977).send("!ot")
ok
Yeah
if hunting_the_hunter:
await ctx.send("!ot")
How to fix this error
says it in the top "was never awaited"
Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'hunting_the_hunter' is not defined
no
you forgot to put True
hunting_the_hunter = True
if hunting_the_hunter:
await ctx.send("!ot")
Now it would work
!e
hunting_the_hunter = True
if hunting_the_hunter:
print("!ot")
@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.
!ot
see
it works π
Ik that lmao
!e
hunting_words = ["!ot", "thats off topic", "getting a bit off topic", "hello"]
for word in hunting_words:
print(word)
@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.
001 | !ot
002 | thats off topic
003 | getting a bit off topic
004 | hello
there
!ot
Off-topic channels
There are three off-topic channels:
β’ #ot2-never-nesterβs-nightmare
β’ #ot1-perplexing-regexing
β’ #ot0-psvmβs-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
!e
for hunting in "hunting the hunter":
print(hunting)
@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.
001 | h
002 | u
003 | n
004 | t
005 | i
006 | n
007 | g
008 |
009 | t
010 | h
011 | e
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/ohowigiqam.txt?noredirect
And yea this has become way too OT
Yeah
Your bored lmfao
i am bored
I know that
Is it related with dpy and discordbots?

it's still True
and okimii is True
and fun is False
but pandabweer is True, so beer is True π
when i persistent a view i cant have interaction_check??
@velvet tinsel Could you please talk further in #ot0-psvmβs-eternal-disapproval since this is not related to this channel.
fine
You can
Can u calm down now?
then why the f i am getting error
Show the f code
yea show the code
calm down bruv
'bot' object has no attribute 'author'
I was being sarcastic
show code bruv
thats the error ||I am being sarcastic||
calm down please
||ok||
class trash(discord.ui.View):
def __init__(self, ctx):
super().__init__(timeout=None)
self.ctx = ctx
#self.bot = ctx.bot
async def interaction_check(self, interaction: discord.Interaction) -> bool:
if interaction.user.id != self.ctx.author.id:
await interaction.response.send_message(
embed=discord.Embed(description=f"{utily.error} Sorry, you can't use this! This interaction belongs to {self.ctx.author.mention}.",color=0x00c8ff), ephemeral=True)
return False
return True
async def on_error(self, error: Exception, item: discord.ui.Item, interaction: discord.Interaction) -> None:
if interaction.response.is_done():
await interaction.followup.send(f'{utily.error} An unknown error occurred, sorry\n**Error:** {error}', ephemeral=True)
else:
await interaction.response.send_message(f'{utily.error} An unknown error occurred, sorry\n**Error:** {error}', ephemeral=True)
raise error
@discord.ui.button(style=discord.ButtonStyle.green, emoji="ποΈ")
async def stop_pages(self, button: discord.ui.Button, interaction: discord.Interaction):
await interaction.response.defer()
await interaction.delete_original_message()
self.stop()
also idk why raise error wont work
like its not printing the error
@maiden fable u helping right?

well the error is from self.ctx.author
but when i persistent. and restart the bot and use the buttons i get that error
ik
bot has no attribute author?
then tell me what is ctx bruv lol
Context bruh
from where
i dont get it
Also to make it look nicer instead of #self.bot do # self.bot
With a space in between
Like from where do u get the Context object
def __init__(self, ctx):
actually according to Pep 8 there must be 2 spaces not one
Oh
pep 8 ?
Maybe not
DUDE where r u using the view
!pep8
PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.
More information:
β’ PEP 8 document
β’ Our PEP 8 song! :notes:
!pep 8
π
there (:
in a command
!d is for dpy commands bruh pep8 isnt something related to it
π
not only dpy but okay
!pep8
!pep 8
Ah ok
π€·ββοΈ
well I guess just try except it?
where?
Look up documentation for Python symbols.

in the interaction_check function?
Not only for dpy
Ok buddy
friend
Ok
Thank
Also
Youβre wrong Hunter
Your bio is wrong
Your about me dict didnβt end with }
So it will return with an error
@maiden fable i cant use ctx
DUDE ITS A DISCORD ISSUE AND ALSO AN OT TALK PLEASE STOP
ok sorry its already night and I just lost my mind. sorry again
coz there is no ctx in on_ready
now how do i get the author without ctx?
!d discord.ext.commands.Bot.add_view
add_view(view, *, message_id=None)```
Registers a [`View`](https://discordpy.readthedocs.io/en/master/api.html#discord.ui.View "discord.ui.View") for persistent listening.
This method should be used for when a view is comprised of components that last longer than the lifecycle of the program.
New in version 2.0.
@maiden fable
already read it
i do
then do message.author
I really need help with this question, sorry for it being poorly worded. If you need more info just ping me, but its tricky to explain. I won't be available until about 5PM est, but until then any help is appreciated https://stackoverflow.com/questions/70236405/add-buttons-with-responses-to-an-embed-discord-py
just send the embed
and the view? whats hard lol
await ctx.send(embed=embed, view=view())
i need to summarize the issue real quick before i go, but basically, it is a repeating task that is called upon twice a day. the embed is in a function i called "main()", it will send the buttons no problem, but when I try to actually get a response, it says this interaction failed. anyways, gtg now, bye!!!
which lib are you using though
Wait you can do?
await ctx.send(embed=embed,view=class())
class is a keyword
Have you tried the support channel of Slash? Or whatever you use it isn't stated.
ofc why cant you..
Its a example
view kwarg takes a class lol
you can but whats the point of having no callback
what lang is this though
nvm
python color on mobile and pc is different for some reason
Idk in disnakes git they assign the class in a var
same thing though
its just an instance of it
Welp never knew it can take a class
cool
Lmao

whats the view ?
yeah but what does it contian ?
which one
and what does it do in the first place
the kwarg or the value
the view=view()
its a discord view
example ?
buttons, select menus
!d discord.ui.View <=
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.
π
how do i add a link to a link buttonstyle button using nextcord?
url kwarg
hey i need a help with my music system or somethin like that
cuz when i type z+play and url for the song the bot dosent play it the bot just join the voice channler and the bot is sillent
@commands.command()
@commands.cooldown(1,2,commands.BucketType.member)
async def buy(self,ctx,*,item):
db = sqlite3.connect("./MiningRPG/main.mysql")
cur = db.cursor()
cur.execute(f"SELECT coins,current_pick FROM rocks WHERE user_id = '{ctx.message.author.id}'")
result = cur.fetchone()
if result is None:
sql = ("INSERT INTO rocks(user_id,mined,curren_pick,coins) VALUES(?,?,?,?)")
var = (ctx.message.author.id,0,"Wooden Pickaxe",0)
cur.execute(sql,var)
db.commit()
cur.execute(f"SELECT coins,current_pick FROM rocks WHERE user_id = '{ctx.message.author.id}'")
result = cur.fetchone()
if item.lower() == "stone pickaxe":
if result[1].lower() == item.lower():
await ctx.send("You already own this item!")
elif result[1].lower() == "iron pickaxe" or result[1].lower() == "ruby pickaxe":
await ctx.send("You already own a better pickaxe!")
elif result[0] < 20:
await ctx.send("You can't afford that!")
else:
current_pick = result[1]
coins = result[0]
sql = (f"UPDATE rocks SET coins = ?, current_pick = ? WHERE user_id = '{ctx.message.author.id}'")
var = (coins - 20, current_pick = "Stone Pickaxe")
await ctx.send("You have bought an **Stone Pickaxe** for 20 coins!")``` are there any unclosed brackets?
it gives me an error and I cant find any
how do I delete a message sent by the bot with discord-py-slash-commands ?
pls sameone i need a help
can you tell me i saw a bot named poke-name it sends msg whenever other bot msgs and tells name it's a verified bot
i wanna make bot like that too that auto replies , when someone sends particular img like some bot sends a image of Pikachu so my bot says name of this Pokemon is pikachu it's done using some kind of image code
It's like a bot replying to other bot's msg (img) knowing what's in that img
please i need a help
sure, show code @hidden stump
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTubeβs robots.txt file; (b) with YouTubeβs prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Sorry but we can't help for these type of questions.
i sent it ealier, still cant find the error lol
im gonna send the whole thing bruh
wait pastebin
Hello, does anyone know how can i have an invisible character on my embedded message?
https://pastebin.com/anTYTdwH where are the bracketsss
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the errors are in var = ()
the ones where you update
how do i make multiple asynchronus while True in the on_ready function?
?
Don't do stuff in on_ready
!d asyncio.create_task
asyncio.create_task(coro, *, name=None)```
Wrap the *coro* [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine) into a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") and schedule its execution. Return the Task object.
If *name* is not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").
The task is executed in the loop returned by [`get_running_loop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop "asyncio.get_running_loop"), [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError") is raised if there is no running loop in current thread.
This function has been **added in Python 3.7**. Prior to Python 3.7, the low-level [`asyncio.ensure_future()`](https://docs.python.org/3/library/asyncio-future.html#asyncio.ensure_future "asyncio.ensure_future") function can be used instead...
ty
!d random.choice
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
then how do I set it
then?
You don't even use the var variable
Why do you need it
If it's for the SQL query, then just remove current_pick =
And keep the string only
!e
d = dict(key="value")
print(d["key"])```
@sullen shoal :white_check_mark: Your eval job has completed with return code 0.
value
that was my bad i didnt type the db.execute(sql,var)
oh wait right
Just like here
sql = ("INSERT INTO rocks(user_id,mined,curren_pick,coins) VALUES(?,?,?,?)")
var = (str(ctx.message.author.id),0,"Wooden Pickaxe",0)
You didn't put any x=, which is correct
how do I get everyone who is in a voice chat in a server
!d discord.VoiceChannel.members
property members: List[Member]```
Returns all members that are currently inside this voice channel.
no everyone
yeah my brain turned off idk why i tried to set it like this
not in one voice chat
Loop though all the voice channels then
every vc
!d discord.Guild.channels
property channels: List[GuildChannel]```
A list of channels that belongs to this guild.
Loop through that
Check if the channel is of type VoiceChannel
Then get the len of the members attribute
And sum them all
for channel in ctx.guild.channels:
if channel == instance(discord.VoiceChannel):
then what
!d isinstance
isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.
Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
ooz
also it can be a one liner
i am making a move all command
well trying
for member in ctx.guild.members:
if member in ctx.guild.voice.channels.members:
print(member)```
ugh
but its not workingggggg
how did ctx.guild.voice.channels.members: join the code
Bots streaming/downloading music from music providers such as YouTube or Spotify are breaching their terms of service, and therefore breaks the #rules 5.
haven't used dpy in a while
if client.user in message.mentions:
hello friends
not working
hm
how can i link images from pages with discord.py? eg to send an image from the bot to a page. Can anyone help me?
property me: discord.member.Member```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
i uh still need help
well if str(message.content) == "<@idhere>":
not working either
how do I check if bot was mentioned
so thats any way to make bot playin music form youtube?
check if discord.Message.mentions has the member instance of your bot
Don't make a music bot, as simple as that
Β―_(γ)_/Β―
but i dont se my code xd
Doesn't matter
We won't help you for questions regarding music bots that stream from YouTube or other services
You need to do your own research on why it doesn't work
anybody?
page?
oh ugh
i use >random and my bot send random photo from this web
ty
so you want to scrape this site for the pictures, and then send them?
yeah
it returns the image directly so it should work by just putting the url in an embed image
I kinda figured it out
however discord may not show new results each time, so you will have to fetch the raw data of the url using aiohttp or smth like that then send the bytedata as a file using discord.File
async def moveall(self, ctx):
mainVC = ctx.author.voice.channel
for channel in ctx.guild.channels:
if channel == isinstance(discord.VoiceChannel, WHAT DO I WRITE HERE):
for member in channel:
print(f"Moved {member.name} to {mainVC.name}")
#await member.move_to(mainVC)```
isinstance(object, classinfo)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError") exception is raised.
Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
please make a little effort by reading it
if isinstance(channel, discord.VoiceChannel):
Clearly says first argument is the object
I DID...
Second is the class you want to check
i just didnt understand it
anyone?
..
just wait
hm?
what do you need help with, exactly
it returns boolean
i did something wrongggg
What do I need to import for errors? (Missing permissions)
thats the value. not the key
i want to know how can I get a code of an img which then i can add so that my bot replies whenever that someone sends that img in embed
Anybody wanna help me on creating a "Advertising" bot. It's not a public but instead a bot that would work in a server that would be used for advertising bots and more. Hm?
@kick.error
async def kick_error(error, ctx):
print('Kick Error Command Called')
print(error)
if isinstance(error, MissingPermissions):
await ctx.send(":x: You don't have permission to do that!")
@ban.error
async def ban_error(error, ctx):
print('Ban Error Command Called')
print(error)
if isinstance(error, MissingPermissions):
await ctx.send(":x: You don't have permission to do that!")
@clear.error
async def clear_error(error, ctx):
print('Purge Error Command Called')
print(error)
if isinstance(error, MissingPermissions):
await ctx.send(":x: You don't have permission to do that!")
These send the error print then something like "MissingPermissions" is not defined
you have to find a way, thats your project not ours. also im pretty sure thats against the bot tos, which breaks one of this server's rule
huh rules?
code
@commands.command()
async def moveall(self, ctx):
mainVC = ctx.author.voice.channel
for channel in ctx.guild.channels:
if isinstance(channel, discord.VoiceChannel):
for member in channel:
#print(f"Moved {member.name} to {mainVC}")
await member.move_to(mainVC)````
WHAT IS WRONG.
yes, #rules, rule 5
ok i will
again, thats the value not the key.
thats not the rule. the rule is to not ask for help which is against the tos of the service. making a bot to get the name of the pokemon which is not allowed by the bot is what youre currently asking for help with
i don't understand tbh it's a verified bot named PokΓ©-Name
so what, go check their TOS
I just wanna create same like that
whose?
what are trying to get
Pokemon bot?
self bot?
PokΓ©-Name
a bot that is doing something which a human is supposed to do
how do I make the prefix @botname
dev of that bot runs this thing in a server with 2-3k members and it's verified works for all Pokemon bots
not to mention admins of Pokemon bot got no problem with it
even if they did I just wanna learn how to make it
ohh
Self botting breaches Discord terms of service, therefore breaks #rules 5. As simple as that.
then learn yourself. many bots like poketwo are against this and that the developer can be in serious trouble for doing shit like that (pokename's dev)
can you explain me then why did that bot got verified
;-;
oh sad but pokemon bot Dev's aren't they are againt self botting as you mentioned but this isn't that ...
thats discord who verified it. not the owners of the pokemon bots
oof
his bot is in 1.6k servers
it breaks poketwo's tos and the code we would help with can be used for their bot too. so it breaks the rule
but I'm not making for poketwo ...
what a pain
a bot in 1.6 servers and verified by discord also breaks tos of discord
No, it's not a self bot.
Yep
so I can't ask for helping me here for a particular bot?
Here we won't help you in making such as bot
ohk
Do your own research or find another server, which I doubt you will find one where people help
idk bout that but fair enough I'll ask someone else in this particular server
looks like its time to ping the mods
HELP.
@plain prairieBottom line is you're developing something to auto reply to an event to get items whenever this pokemon bot sends an image
That is most likely against the bots tos
hm
but I don't understand the fact that one i saw is verified + in big servers
discord checks when they verify a bot right
what it does who made and all
Its not against discord tos, its against the bots terms of service
Therefore we're not allowed to help but the bot can still get verified
ok so that aside you can help me with that code we get from an img stuff it really makes my head hurt
No. That would break rule 5
fair enough but it's not written anywhere but ok nvm
support_buttons = [[Button(custom_id='administrator'),Button(custom_id='community')]]
support_buttons[0][1].disabled = True
await interaction.edit_origin(components=support_buttons)
Hey im trying to disable a button after its been clicked, not sure if im doing it right here? Im getting no errors but it also isnt working
now getting a code of an img is mentioned in discord documentation how come
but I'm fool enough that i can't find it it's too long and I don't understand coding that well
process of every img it's something like that
processing*
Because getting the source of an image is allowed. What you're trying to implement it for is not
can you forget that I'm even making something
No
pain
Follow this servers tos. Its just that simple
so you can tell me that in some other server
or dm
No
ah
how do I make the bot reply to messages
like this
How can I check who clicked on a component with discord-py-slash-command ?
!d discord.Message.reply
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.
@commands.command()
async def pay(self, ctx, member: discord.Member = None, amount: int = None):
def check(message:str):
return message.author == ctx.author and message.channel == ctx.channel
if not member:
await ctx.send("You must specify a member to pay.")
return
await ctx.send("How much would you like to pay?")
message = await bot.wait_for('message', check=check)
if not member:
await ctx.send("You must specify a member to pay.")
return
recipient = member
sender = ctx.author
users = await get_bal()
if users[str(sender.id)]["balance"] < abs(int(message.content)):
await ctx.send("You don't have enough money.")
return
else:
users[str(recipient.id)]["balance"] += abs(int(message.content))
with open ("balance.json", "w") as f:
json.dump(users, f)
sender = ctx.author
users = await get_bal()
users[str(sender.id)]["balance"] -= abs(int(message.content))
with open ("balance.json", "w") as f:
json.dump(users, f)
await ctx.send(f"You have successfully paid {recipient.mention} ${(abs(message.content))}.")```
this command stops working after you tell it how much money you want to pay. anyone know why?
!d discord.Embed.colour || embed = discord.Embed(colour=#ffff)
The colour code of the embed. Aliased to color as well. This can be set during initialisation.
no errors btw^
you have a whack error handler. len(limit) is erroring because you can't use len on an int.
I have a problem with the same command (with different code, but it is also the clear command)
from discord.ext import commands
class Clear(commands.Cog):
"""Apaga mensagens"""
def __init__(self, bot):
self.bot = bot
@commands.command(name = "clear")
@commands.has_permissions(manage_messages = True)
async def clear(ctx , amount=2):
await ctx.channel.purge(limit=amount)
def setup(bot):
bot.add_cog(Clear(bot))```
But then it gives this error:
so what should i do
hey thats more of a DB question, but
cur.execute(f"SELECT current_pick FROM rocks WHERE user_id = '{ctx.message.author.id}'")
result = cur.fetchone()
pickaxe = result[0]
cur.execute(f"SELECT {pickaxe.lower()} FROM tools")
result = cur.fetchone()
pickaxe_power = result[0]
cur.execute(f"SELECT {ore.lower()} FROM ores")
result = cur.fetchone()
ore_power = result[0]``` what is "pickaxe"? when i try to use it later it says theres no column "wooden", and the value should be "Wooden Pickaxe" if i understand correctly
async def clear(self, ctx , amount=2):
when in a class you use self as an argument
a) print(error) in your global error handler b) if len(str(limit))
omg, how did I miss that. Thanks <3
If it's a db question maybe #databases know
And I assume pickaxe is a variable that holds a string value
Its in a class you need the self arg
ty
If I have made a group command called edit. It has a @edit.command() called message. Can I make a subcommand for that message? Like group for alrd group command
Yes it can be color or colour really doesnt matter
up ?
Now I have another problem: when the person has permission to delete, it works fine. It deletes the messages without saying anything (which is supposed to happen). But when the person doesn't have permission, it says that the command doesn't exist, instead of saying that the person doesn't have permission to use it. How do I fix it?
Code where it shows the errors to the person:
from discord.ext import commands
from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument, MissingPermissions
class Manager(commands.Cog):
def __init__(self, bot):
self.bot = bot
# <- Detetar alguma coisa numa mensagem e apagar a mesma ->
@commands.Cog.listener()
async def on_message(self,message):
id = message.author.id
if message.author == self.bot.user: # Evita um loop infinito
return
if "discord.gg" in message.content:
await message.channel.send(f"<@{str(id)}>, will we stop sending links from other servers? That is not allowed here!")
await message.delete()
# <- Mostrar mensagem de erro ->
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, MissingRequiredArgument):
await ctx.send("Please send all arguments. Type `.help` for the parameters of each command.")
elif(error, CommandNotFound):
await ctx.send("This command does not exist! Type `.help` to see all commands.")
elif(error, MissingPermissions):
await ctx.send("You don't have permission to use this command.")
else:
raise error
def setup(bot):
bot.add_cog(Manager(bot)) ```
reply is not defined
await reply(content=None, embed=embed)
when my bot gets added, how would it send a message to the person who added it?
no like what event is it? like on_bot_add or something?
async def purge(ctx, limit:int):
if len(str(limit)) >= 1501:
em = discord.Embed(title=f"",description=f" - Maximum purge count: `1500`", color=clr)
await ctx.send(embed=em)
return
else:
await ctx.channel.purge(limit=limit + 1)
await ctx.send('Successfully Cleared `{}` Messages'.format(limit)) ```
also should that reply to the message like this
client
yea but what do i do
yeah thats what i mean sorry, what do i put under async def .....()
no for when someone adds your bot
async def purge(ctx, limit:int):
if len(str(limit)) >= 1501:
em = discord.Embed(title=f"",description=f" - Maximum purge count: `1500`", color=clr)
await ctx.send(embed=em)
return
else:
await ctx.channel.purge(limit=limit + 1)
await ctx.send('Successfully Cleared `{}` Messages'.format(limit)) ```anyone know why this happens
on_guild_join
when someone adds your bot it sends the person who added a dm
thank you sm
sorry im tired, you dont put len or str
so if limit...
if limit >=
that makes sense, also no worries lol
discord.Embed(colour=00FF00) doesn't show color
am I using a wrong module lol
embed = discord.Embed(colour=00FF00)
embed.add_field(name="Version", value=version)
embed.add_field(name="Author", value=author)
embed.add_field(name="Prefix", value=prefix)
await reply(content=None, embed=embed)
sends normal message
normal embed
not reply and not colored
caeden
can you help me with this?
guys what was the argument to pass in command decorator to say that the command accept arguments? pass_context or pass_content?
thats deprecated and isnt used anymore.
0x00FF00
!d discord.Colour.green || or this
classmethod green()```
A factory method that returns a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour") with a value of `0x2ecc71`.
The on_message event is not a command, on_command_error is used to handle command error, the decorator used is the name of the command when you created it, here is an example:
from discord.ext.commands import command
# Your codes here
@command()
async def command_name(ctx):
# Here what the command does
@command_name.error()
async def command_name_error_handler(ctx, error):
# The error handler
F π¦
how to get the 1st channel withj
for channel in guild.text_channels:```
1st? as in top channel?
yea
I dont think it is ordered
well how would i just get 1 channel then?
!d random.choice || random_channel = random.choice(guild.text_channels)
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
ty
alright, quick question-
My bot is sort of like a game, where you can own companies and make money from them or whatever, and I have it so the "work" command has a cooldown on it.
I was wondering if there is a way to get the value of how many companies the user owns, then change how many time a user can run the command in the time period based on how many companies they own, if that makes sense.
I'll make an example of how the amount of companies are found.
#this gets the amount of companies
await open_inv(ctx.author) #this is defined in a different bit of code that creates an inventory in a json file for each user
user = ctx.author
users = await get_inv(ctx.author) #this is also defined in a different bit of code which gets the information from the json file
companies = users[str(user.id)]["Companies"]
#this is how i would want to change the amount of times the command can be ran
@commands.cooldown(companies, 390, commands.BucketType.User)```
is it possible to do something like this? (If anything I said made sense π)
Why does this not edit role permissions? It sends a message and everything but it does not work as it should, it's supposed to lockdown a server ```py
@defcon.command(aliases=["lockdown", "activate", "lock"])
async def shutdown(self, ctx):
role = ctx.guild.get_role(self.default)
permissions = role.permissions
permissions.update(send_messages=False,add_reactions=False,send_messages_in_threads=False,connect=False)
await role.edit(reason="shutdown", permissions=permissions)
await ctx.send(f"Server shut down.")
self.default is a role ID of member role
how do you get the message that did the command?
lol
mythic lol why you here ?
who are u
...?
read our dms
we don't do that here

how do you get the message that did the command?
how do I make a list of words which it checks if the message has
This should be correct, right?
so ctx.message?
how do I make this work
if ["word1", "word2", "word3"] in message.content.lower():
so it would check if the message has any of those
if message.content.lower() in ["word1", "word2", "word3"]:
wont work cuz it would only check if the message is that word
emojis['Vermelho']?
Idk, maybe I'm missing something
As variable then, emoj = emojis['vermelho']
Emoj because I'm scared name collision error
does anyone know how to do this, or if it's possible?
how do I make this work
if ["word1", "word2", "word3"] in message.content.lower():
so it would check if the message has any of those
if message.content.lower() in ["word1", "word2", "word3"]:
wont work cuz it would only check if the message is that word
So check if any word is inside of a sentence?
yes
Do if 3 times I guess
but it needs to be a list
Or use this
if any([x for x in message.content.lower().split() if x in ["word1", "word2"]])
def exist(check, word):
for test in check:
if test in word:
return True
return False
exist(["a", "b", "c"], "atest")
Or yeah this could work
Panda's method better
thx
saved me a lot of time and space
does anyone know how to get a channel object if you have the id?
.bm
file.write(f"{current_time} : {message.author.mention} : {message.content} : {message.channel}\n")
overwrites the last line everytime
client.get_channel(id/ints)
doesn't start new line
thanks
uh, at the end do file = '', maybe that will work?
or use a context manager, because i did the same thing as you to log messges
like the exact fricking thing some how :/
That's against discord's ToS π
really?
Logging mgs right
In fact, it's literally the reason why the message intent is becoming privileged
shit
Well, one of the main reasons
guess i gotta remove that now
well, not exactly.
It is
Ah i see
if the bots are logging messages on their own database, discord only requires that the messages are encrypted and don't last more than 30 days.
okay
now if it's just a temporary value, and it stops existing as soon as i.e, the process is shut down. it's perfectly fine.
or if it fits the above criteria,
that is why i said "not exactly"
Oh alr
I think logging msgs in general isnt right if you dont have a reason for it
well there's real uses for such a thing
Yeah ik like moderation
like "sniping" deleted and edited messages
But just logging them for no reason is againsts tos
Seen it but whats that exactly?
well im making a moderation bot
uh so
whenever a message is deleted or it's content is changed by the original author, these bots will temporarily store the original content to display it to the mods if necessary later on.
Yeah ive seen it before
anyone know how to keep last line and add data to new line in file.write
you could use the append mode, open("file", "a")
ah yes
although if you're planning long term storage, please switch to a database instead.
how do I loop thru all channels and check if they are a specific channel
Guys to make my bot don't eat specified command error with the on_command_error event i just need to use the listener instead of the event right?
smthng like this
for channel in channels:
if str(channel) == "logs":
await channel.send_message("debug")
what do I loop thru
aka change the channels to
!d discord.Guild.channels
property channels: List[GuildChannel]```
A list of channels that belongs to this guild.
AttributeError: module 'discord.guild' has no attribute 'channels'
the discord.guild is just the class of a Guild, you need the guild object where the channels are
you can retrieve it by the context if it is used in a command, else you need some other way to convert a Guild by it's ID
We also won't help you spam channels.
for channel in ctx.guild.voice_channels:
# Do something to channels.
Just remember discord guidelines and TOS while doing anything in the platform.
Guys i have a task loop in a Cog but it won't run. Here is the code:
class MainLoop(Cog):
def __init__(self, bot):
self.bot = bot
@loop(seconds=2)
async def check_news(self):
data = db.records("SELECT * FROM oPNEWS", None)
print(data)
It should print something every two seconds but it doesn't
Are you starting the task?
from discord.ext import tasks, commands
class MyCog(commands.Cog):
def __init__(self):
self.index = 0
self.printer.start()
def cog_unload(self):
self.printer.cancel()
@tasks.loop(seconds=5.0)
async def printer(self):
print(self.index)
self.index += 1
On this discord.py documentation example you can clearly see that self.printer.start() starts the task.
I don't see that on your cog.
Lol maybe i need to sleep...
db.records is a blocking call right?
And the loop runs every 2 seconds
Meaning the bot would freeze up for X amount of time per 2 seconds during its lifetime
Not ideal
Yeah it is only a test, i don't wont to wait half an hour every time i need to test xD
Can anyone reccomend a afordable half decent VPS just to host my discord bot on?
HETZNER
i just bought a vps the other day for my bot, it works beautifully
speaking of that...I need someone to help me again...
this is what it looks like so far...
@stark lintel Whats wrong with your bot?
async def survey():
embed = discord.Embed(color = 0x800020)
embed.title = "Survey!"
embed.description = "Click a button below to submit an anonymous survey!"
#embed.set_thumbnail(url=pic1)
embed.timestamp=datetime.datetime.utcnow()
embed.set_footer(text=f'AHSweather v{_version_} \u200b')
bcc = client.get_channel(886307415518240768)#general
buttons = [create_button(style=ButtonStyle.green, label="I liked it", custom_id='3'), create_button(style=ButtonStyle.grey, label="I'm neutral"), create_button(style=ButtonStyle.red, label="I did not like it")]
action_row = create_actionrow(*buttons)
bcc2 = await bcc.send(embed=embed, components=[action_row])
@client.event
async def on_component(ctx: ComponentContext):
# you may want to filter or change behaviour based on custom_id or message
await ctx.edit_origin(content="You pressed a button!")
@client.event
async def on_ready():
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name='your AHS weather!'))
print(f'Connected to bot: {client.user.name}')
print(f'Bot ID: {client.user.id}')
warnings.simplefilter('ignore')
scheduler = AsyncIOScheduler()
scheduler.add_job(main, CronTrigger(hour = 3, minute = 30, second = 0))
scheduler.add_job(survey, CronTrigger(hour = 15, minute = 35, second = 0))#3, 30, 10
scheduler.add_job(main, CronTrigger(hour = 18, minute = 0, second = 0))
scheduler.add_job(survey, CronTrigger(hour = 18, minute = 0, second = 0))
scheduler.start()
print("")
print(f"v{_version_} SYSTEM READY {time.strftime('%H:%M:%S, %m-%d-%Y')}...")
client.run(TOKEN)
this is the code giving me issues
my buttons dont function
and im not sure why
What fork?
@loop(seconds=15.0)
async def check_news(self):
data = db.records_no_values("SELECT * FROM oPNEWS")
if data is not None:
for guild, channel, address in data:
if channel is not None:
guild: Guild = self.bot.get_guild(guild)
channel: TextChannel = self.bot.get_channel(channel) # 901956294775275541
html_page = requests.get('https://www.outplayed.it').content
doc = BeautifulSoup(html_page, "html.parser")
latest = doc.find_all(attrs="td-module-thumb")
latest_news = latest[0].parent.find("a")
if address is None or (address != latest_news['href']):
logo = doc.find_all(attrs="td-logo")
link_logo = logo[0].parent.find("img")
await channel.send(f"{link_logo['src']}")
await channel.send(f"***\"La redazione di Outplayed ha pubblicato un nuovo articolo, "
f"link in descrizione\"***\n\n"
f"{latest_news['href']}")
db.execute("UPDATE oPNEWS SET OldNews = ? WHERE GuildID IS ?", latest_news['href'], guild.id)
return
Why the get_guild and get_channel returns me None? i checked and the IDs are correct
Not really but what fork like dpy fork
tbh, im not sure, just whatever is in the discord button docs
Ah well dont know about it
f
Digital ocean is good and cheap
when it says ctx: ComponentContext, am i supposed to change that value?
For servers Uptime Robot is also good
Depends really
Wdym by not saving
It works pretty well for me
Thats good ig how much do you pay for?
Try looking in #databases
Ah my bad dont really know what it is
Dont think its a db
so okimii you have no idea about my bot issue?
No not really i dont use it i only use disnake
Nah never used pickle i only use dbs
Seen people with issues so idrk
Its works with no problems for me
Β―_(γ)_/Β―
π€·ββοΈ
Digital ocean is good cheap and secure and i think its in america for all the american users
@polar ice heres allot of options #discord-bots message
My bot is sending 10 links to the 10 images it was supposed to send but only 5 of them are embedded. Is this because it's a bot account or is there something I need to code?
the bot isn't ready yet
yeah i noticed, i made it so it skips the first loop
!code
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.
'''py
print('Hello world!')
# Lire le fichier
fichier = open("log.txt", 'r')
contenu_du_fichier = fichier.readline()
print(contenu_du_fichier)
# clicks
clicks = contenu_du_fichier
what
I have a discord bot in which I am trying to send a message over 4000 characters over dm. How do I instead sent this message as a text file
with open('readme.txt', 'wb') as f:
f.writelines("Stuff")
await ctx.send(file=discord.File(r'readme.txt'))
ty
ok, so i changed my code a little hoping it would work
and it still wont work...
async def survey():
embed = discord.Embed(color = 0x800020)
embed.title = "Survey!"
embed.description = "Click a button below to submit an anonymous survey!"
#embed.set_thumbnail(url=pic1)
embed.timestamp=datetime.datetime.utcnow()
embed.set_footer(text=f'AHSweather v{_version_} \u200b')
bcc = client.get_channel(886307415518240768)#general
#buttons = [create_button(style=ButtonStyle.green, label="I liked it", custom_id='3'), create_button(style=ButtonStyle.grey, label="I'm neutral"), create_button(style=ButtonStyle.red, label="I did not like it")]
await bcc.send(embed=embed, components=[
Button(style=ButtonStyle.red, label="Click")
]
)
interaction = await client.wait_for("button_click", check=lambda i: i.component.label.startswith("Click"))
await interaction.respond(content="Button Clicked!")
print("done")
Arent quotes but backticks
any ideas at all?
irrc a message with 1000 or more characters get turned into a txt file by discord
Well if there is a good free version
then I would use that
@polar ice
Nah but the lowest price is 5$ a month
@steep drift hello?
k
hey
Not really bad and is kinda overkill for a bot with 100 or less guilds
Ideally id like a cheap windows one. Be much easier for me to use. never really used linux
