#discord-bots

1 messages · Page 70 of 1

mossy jacinth
#

Turns out it was bot.slash_command 😭

#

I waited so long for nothing

slate swan
#
    @commands.command()
    async def poll(ctx,*,message):
        em = discord.Embed(title="Server Poll", description="{message}")
        msg = await ctx.channel.send(emebd=em)
        await msg.add.reaction('👍')
        await msg.add.reaction('👎')``` Anyone know why my poll cmd wont work
wicked atlas
#

If this command is part of a cog, you need to add self as the first parameter, since it's part of a class

wicked atlas
#

If that method is also part of the class, it also needs self as it's first parameter

#

any functions that are part of a class need the self parameter as their first parameter, unless if is a staticmethod or classmethod

slate swan
#
    @commands.command()
    async def poll(self, ctx,*,message):
        em = discord.Embed(title="Server Poll", description="{message}")
        msg = await ctx.channel.send(emebd=em)
        await msg.add.reaction('👍')
        await msg.add.reaction('👎')```
torn sail
wicked atlas
#

Hmm, no, it actually looks like on_command_error is being called with less arguments than it should be, which is weird

slate swan
# torn sail Add `self` to `on_command_error`
async def on_command_error(self, ctx, error):
    if isinstance(error, commands.MissingPermissions):
        em = discord.Embed(color=discord.Color.orange(), description=f"{ctx.author.mention}: You're **missing** permission: `{error.missing_permissions}`")
        await ctx.send(embed=em)
    else:
        raise error```
#

I have self

wicked atlas
#

Ahh, this one isn't in a class

#

you can remove self from it

torn sail
slate swan
#

are you in a cog? if not, use bot.slash_command

austere vale
#
class MusicCog(commands.Cog, name='Music'):
  '''play, pause, resume, stop, disconnect'''
  def __init__(self, bot):
    self.bot = bot
    bot.loop.create_task(self.node_connect())
  async def node_connect(self):
    await self.bot.wait_until_ready()
    await wavelink.NodePool.create_node(bot=self.bot,host= 'lavalinkinc.ml',port=443,password='incognito',https=True)
  @commands.Cog.listener()
  async def on_wavelink_node_ready(self, node:wavelink.Node):
    print(f'Node {node.identifier} is ready!')
  #play
  @commands.command()
  async def play(self,ctx:commands.Context,*, search: wavelink.YouTubeTrack):
    if not ctx.voice_client:
      vc:wavelink.Player=await ctx.author.voice.channel.connect(cls= wavelink.Player)
    elif not getattr(ctx.author.voice, 'channel', None):
      await ctx.send('Join a voice channel first...')
      return
    else:
      vc:wavelink.Player=ctx.voice_client
    await vc.play(search)
    await ctx.send(f'Now playing {search.title}!')

whenever i try to play something, my bot joins the voice call, it sends the "now playing" message, but it doesnt play anything. theres no input or anything and my bot's icon doesnt light up green. does anyone know what's happening?

slate swan
# wicked atlas Ahh, this one isn't in a class
    @commands.command()
    async def poll(self, ctx,*,message):
        em = discord.Embed(title="Server Poll", description=f"{message}")
        msg = await ctx.channel.send(embed=em)
        await msg.add.reaction('👍')
        await msg.add.reaction('👎')``` **It sends the embed/poll but no reactions**
#

its add_reaction

#

oh

sick birch
austere vale
#

oh youtube doesnt allow any discord bots to play their videos?

sick birch
#

No, it doesn't. That's the reason why Rhythm and Groovy got taken offline

wicked atlas
#

Any kind of downloading of youtube videos is against youtube TOS

pliant gulch
#

Not all

#

If your YouTube premium, you can download videos

#

I’m gonna assume YouTube didn’t make that against TOS…

shrewd apex
#
for i in self.children:
    i.style = # ur style
# edit the message with the view
primal token
#

!d discord.ui.View.children

unkempt canyonBOT
slate moss
#

!d help

unkempt canyonBOT
#

help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.

Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).

This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
slate moss
#

nvm

civic pagoda
#

why is this not working?

hushed galleon
#

you can use the setup_hook method to add it before your bot connects to discord

#

e.g. ```py
bot = commands.Bot(...)

@bot.event # hacky way to override the setup_hook
async def setup_hook():
await bot.add_cog(...)```

hushed galleon
#

that is truly some janky code, but were you getting an error with it? given that its a disnake slash command i dont think that send() is meant to return anything, so editing the response after the duration should be done with Interaction.edit_original_message()

#

also time.sleep() is a blocking function and should be replaced with the async variant await asyncio.sleep(...)

slate swan
hushed galleon
sick birch
#

If disnake's views are similar enough to discord.py (looks like it from your code snippet), you haven't initialized the superclass

hushed galleon
hushed galleon
sick birch
#

Ah, is the superclass initialized by default?

shrewd apex
#

normally in init using super only timeout is set

#

so in this timeout is none by default

hushed galleon
#

i thought it was 180s

shrewd apex
#

!d discord.ui.View

unkempt canyonBOT
#

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

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

New in version 2.0.
shrewd apex
#

oh yes

hushed galleon
#

🎉

slate swan
#

hi what is the difference between @bot.event and @client.event?

#

okay thank you

#

I don't understand the problem could you help me?

#

erase it and write it again, make sure to save your code as well

slate swan
#

I am French I struggle a little

shrewd apex
#

u can use latency property u k?

slate swan
shrewd apex
#

!d discord.ext.commands.Bot.latency

unkempt canyonBOT
#

property latency```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.

This could be referred to as the Discord WebSocket protocol latency.
slate swan
#

and outdated code... bot.say is not a thing anylonger

shrewd apex
#

well now u know

drifting arrow
#

Anybody able to assist me with setting up websockets inside a discord bot? 🤔

sick birch
drifting arrow
#

I want to use websockets to get a feed from a website (battlemetrics.com), I have the code for it to work without a discord bot, but now I need to integrate it into a discord bot xD

sick birch
#

Not sure if you can have multiple websockets on the same process

#

Worth a shot though as long as you use asynchronous websockets

#

aiohttp has built in sockets

slate swan
#

I would like to learn to make bots but I have only worries and I am French so it is boring translate who could tell me why its makes me its while the bot is online and the cmd works nickel so why does the command not work? please

drifting arrow
#

idk i dont think i can. maybe I am just doing it wrong tho 🤔

drifting arrow
#

@sick birchSo I couldnt figure out how to do the websocket thing inside of a discord bot. So I did one step better. I will use my webhook discordbot bot with my websocket code and have the websocket stuff send to my server ;D

vocal snow
#

"bot.say", "bot.logs_from" etc are from an older version of discord.py which doesn't work anymore

slate swan
#

I agree but the normally sa must work?

#

you need to enable message_content intents

slate swan
#

in the code as well, add ```py
intents.message_content = True

slate swan
#

Hi! So I'm in need of a free hosting, I tried replit but I get rate limited like every 10 minutes. Is there anything else I can use that does suck too much?

vocal snow
#

GCP and AWS have free tiers, if you're a student you can consider applying for the github student developer pack which will give you ~300$ in azure credits and 200$ in digital ocean credits

slate swan
#

Does GCP and AWS require linking credit cards?

vocal snow
#

aside from that I'd say get a raspi, the newer ones are really good and you can use them for a bunch of stuff

azure scroll
#

for taking a user as an argument, like: !foo @someuser, this should work right? user : discord.Member

vocal snow
slate swan
#

Sad, what's raspi?

vocal snow
#

afaik Azure from the gh student developer pack is the one free one which won't require cc verification

slate swan
#

Is it easy to get the student pack?

vocal snow
vocal snow
slate swan
#

Alright, I don't have a ID card.

#

But if I need to, online, for free host a discord bot, without any credit card information, is replit the only way?

vocal snow
#

probably

#

although you're bound to incur a shitload of issues with it

slate swan
#

Yeah, suppose.

jolly basalt
#

how do i check if a channel has new messages

silk fulcrum
jolly basalt
#

like when people send new messages, my bot needs to detect it

jolly basalt
#

i think im high or smth was that it

slate swan
#

ValueError: could not find open space for item

ashen perch
#

could someone help with this error im getting?
heres my code

from discord.ext import commands
import json

# Get configuration.json
with open("configuration.json", "r") as config:
    data = json.load(config)
    token = data["token"]
    prefix = data["prefix"]

intents = discord.Intents.default()
intents.typing = False
intents.presences = False
intents.members = True

bot = commands.Bot(prefix, intents = intents)

# Load cogs
initial_extensions = [
    "Cogs.help",
    "Cogs.ping"
]

print(initial_extensions)

if __name__ == '__main__':
    for extension in initial_extensions:
        try:
            bot.load_extension(extension)
        except Exception as e:
            print(f"Failed to load extension {extension}")

@bot.event
async def on_ready():
    print(f"We have logged in as {bot.user}")
    await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name =f"{bot.command_prefix}help"))
    print(discord.__version__)

@bot.command
async def ping(ctx):
    await ctx.send("respond")

bot.run(token)```

and here is the error
```Traceback (most recent call last):
  File "/Users/User/Desktop/Discord/discord-network-test/main.py", line 43, in <module>
    bot.run(token)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 723, in run
    return future.result()```
slate swan
#

ValueError: could not find open space for item

slate swan
#

can someone help me?

#

2022-08-31 12:28:58 ERROR discord.ui.view Ignoring exception in view <menu timeout=180.0 children=1> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='test' emoji=None row=None>

placid skiff
#

!rule 4

unkempt canyonBOT
#

4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.

placid skiff
#

failed

#

!rule 7

unkempt canyonBOT
#

7. Keep discussions relevant to the channel topic. Each channel's description tells you the topic.

slate swan
#

i am not speaking arabic here

#

this is related to discord bot

placid skiff
#

Lmao you sent a value error, code and full traceback

slate swan
#
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 425, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\User\Desktop\imp\AstralRp-Bot\slashcoms.py", line 46, in menu1
    await interaction.response.send_modal(modal())
  File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\modal.py", line 135, in __init__
    super().__init__(timeout=timeout)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 184, in __init__
    self.__weights = _ViewWeights(self._children)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 99, in __init__
    self.add_item(item)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 116, in add_item
    index = self.find_open_space(item)
  File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 106, in find_open_space
    raise ValueError('could not find open space for item')
ValueError: could not find open space for item```
#

2022-08-31 12:28:58 ERROR discord.ui.view Ignoring exception in view <menu timeout=180.0 children=1> for item <Button style=<ButtonStyle.success: 3> url=None disabled=False label='test' emoji=None row=None>

#
class menu(ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @ui.button(label="test",style=discord.ButtonStyle.green)
    async def menu1(self,interaction:discord.Interaction,button:ui.Button):
        await interaction.response.send_modal(modal())```
#

a row cannot have more than 5 buttons

slate swan
#

is that all of your code? ( for the view)

ashen perch
# placid skiff this is the full traceback?

here is the full error

  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 999, in _create_direct_connection
    hosts = await asyncio.shield(host_resolved)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 865, in _resolve_host
    addrs = await self._resolver.resolve(host, port, family=self._family)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/resolver.py", line 31, in resolve
    infos = await self._loop.getaddrinfo(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 860, in getaddrinfo
    return await self.run_in_executor(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/socket.py", line 955, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/User/Desktop/Discord/discord-network-test/main.py", line 43, in <module>
    bot.run(token)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 723, in run
    return future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 702, in runner
    await self.start(*args, **kwargs)
#
    await self.login(*args, bot=bot)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/client.py", line 511, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/http.py", line 300, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/http.py", line 192, in request
    async with self.__session.request(method, url, **kwargs) as r:
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/client.py", line 1117, in __aenter__
    self._resp = await self._coro
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/client.py", line 520, in _request
    conn = await self._connector.connect(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 535, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 892, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1011, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [nodename nor servname provided, or not known]```
slate swan
# slate swan is that all of your code? ( for the view)
class menu(ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @ui.button(label="test",style=discord.ButtonStyle.green)
    async def menu1(self,interaction:discord.Interaction,button:ui.Button):
        await interaction.response.send_modal(modal())

        
    
@client.command()
async def test(ctx):
    view=menu()
    await ctx.send(view=view)
ashen perch
#

(sorry for spamming channel)

slate swan
slate swan
#

still not working dude

#

show updated code

#

same error Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 425, in _scheduled_task await item.callback(interaction) File "c:\Users\User\Desktop\imp\AstralRp-Bot\slashcoms.py", line 46, in menu1 await interaction.response.send_modal(modal()) File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\modal.py", line 135, in __init__ super().__init__(timeout=timeout) File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 184, in __init__ self.__weights = _ViewWeights(self._children) File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 99, in __init__ self.add_item(item) File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 116, in add_item index = self.find_open_space(item) File "C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\discord\ui\view.py", line 106, in find_open_space raise ValueError('could not find open space for item') ValueError: could not find open space for item

#
class menu(ui.View):
    def __init__(self):
        super().__init__()
        self.value = None

    @ui.button(label="test",style=discord.ButtonStyle.green)
    async def menu1(self,interaction:discord.Interaction,button:ui.Button):
        await interaction.response.send_modal(modal())

        
    
@client.command()
async def test(ctx):
    view=menu()
    await ctx.send("hello",view=view)```
ashen perch
placid skiff
slate swan
#

seems like an issue with the modal then

slate swan
#

it's not much right?

#

depends on how you place that question

ashen perch
#

im guessing its this ?

slate swan
#

are they all TextInput s?

slate swan
slate swan
ashen perch
#

k thanks!

slate swan
#

ight gimme a moment

azure scroll
ashen perch
#

i believe it is to do with my internet connection

slate swan
#

yeah that as well

#

you found a solution mr. sarth?

#

well the limit is 25, i wonder why 8 text inputs would be an issue

#

even 6 is giving me problem

eager shuttle
#

guys i tried uptimerbot and its not working

slate swan
#
class modal(ui.Modal,title = "Testing App"):
    Discordname = ui.TextInput(label="Discord Username",style = discord.TextStyle.short,placeholder="(ex. Slump#0001)",required=True)
    howlong = ui.TextInput(label="How long have you been a part of AstralRP?",style = discord.TextStyle.short,placeholder="Your Answer?",required=True)
    everkickedorbanned = ui.TextInput(label="Have you ever been kicked or banned from AstralRP? if yes, Explain",style = discord.TextStyle.short,placeholder="Your Answer?",required=True)
    whydoyouwannabestaff = ui.TextInput(label="Why do you want to be a staff member? and what can you bring to the staff team?",style = discord.TextStyle.long,placeholder="Minimum 50 words",required=True)
    hadanypastexperience = ui.TextInput(label="Have you had Past experience being staff or management in other rp servers?",style = discord.TextStyle.long,placeholder="Your Answer?",required=True)
    whataretwothingsyoulike = ui.TextInput(label="What are two things you like about AstralRP",style = discord.TextStyle.short,placeholder="Your Answer?")
    ``` any idea?
ashen perch
#

when i try to re-run the certificate i get error message
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at >: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known')': /simple/certifi/

eager shuttle
rugged shadow
#

mr. sarth

placid skiff
slate swan
ashen perch
eager shuttle
#

its says paths not found

ashen perch
#

ah ok

placid skiff
#

are you using a venv? pycharm creates a new one with every project as default

ashen perch
eager shuttle
#

i did create a new project yes and i tried to load discord.py but it wont come in pycharm

eager shuttle
placid skiff
slate swan
eager shuttle
#

so this is the keep alive code

eager shuttle
#

i basically just copied it

slate swan
# slate swan no

which means the textinput has not been added yet, you need to self.add_item(variable used for textinput) for all those modals

#

ok

ashen perch
#

can you send main file please?

slate swan
#

@slate swan do i need to do it in the modals class?

slate swan
eager shuttle
# ashen perch can you send main file please?

import discord
import random
from keep_alive import keep_alive
TOKEN = "........"
intents = discord.Intents.default()
intents.members = True
intents.message_content = True
client = discord.Client(intents=intents, command_prefix='!')

@client.event
async def on_ready():
print("we have logged in as {0.user}".format(client))

keep_alive()

client.run(TOKEN)

vale wing
#

Oh mo replit

#

Me no like replit

slate swan
#

"message": ""self" is not defined",
adding it to the modals class

eager shuttle
ashen perch
eager shuttle
#

me like it

vale wing
#

Sell your data to oracle and enjoy free tier idk

ashen perch
#

oh yea doesnt oracle have like free servers

eager shuttle
#

now it doesnt work

slate swan
# slate swan yeah wherever you defined those variables
class modal(ui.Modal,title = "Testing App"):
    
    Discordname = ui.TextInput(label="Discord Username",style = discord.TextStyle.short,placeholder="(ex. Slump#0001)",required=True)
    howlong = ui.TextInput(label="How long have you been a part of AstralRP?",style = discord.TextStyle.short,placeholder="Your Answer?",required=True)
    everkickedorbanned = ui.TextInput(label="Have you ever been kicked or banned from AstralRP? if yes, Explain",style = discord.TextStyle.short,placeholder="Your Answer?",required=True)
    whydoyouwannabestaff = ui.TextInput(label="Why do you want to be a staff member? and what can you bring to the staff team?",style = discord.TextStyle.long,placeholder="Minimum 50 words",required=True)
    
   ```if i add self.add_item it will throw an error
eager shuttle
#

like type it in monospace

slate swan
#

!codeblock

eager shuttle
ashen perch
eager shuttle
#

one of my friends told me to use replit as pychram eats at your storage

ashen perch
#

although maybe try get someone else's opinion who is more knowledgable on this

eager shuttle
#

for now imma just try to get discord.py to work on pycharm

slate swan
#

guys how check if player have permissions administrator in py @bot.slash_command(name='channel', description="lock Or UnLock The Channel!") async def channel(ctx, mode): if mode == "lock" or "Lock": perms = ctx.channel.overwrites_for(ctx.guild.default_role) perms.send_messages=False await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=perms) await ctx.send(f'**Channel Locked!**') if mode == "unlock" or "Unlock" or "UnLock" or "unLock": perms = ctx.channel.overwrites_for(ctx.guild.default_role) perms.send_messages=True await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=perms) await ctx.send(f'**Channel UnLocked!**')

ashen perch
#

personally i use visual studio code which i found to work well, and host my stuff via one of my friend who owns a server

vocal snow
#

the ide doesnt really matter

ashen perch
#

true

eager shuttle
eager shuttle
eager shuttle
#

damn looks like imma have to download vsc again

#

im just getting started with python really

ashen perch
#

in terms of software

eager shuttle
#

ah

slate swan
placid skiff
unkempt canyonBOT
#

@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions").

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

;-;

#

I was about to send it

silk fulcrum
unkempt canyonBOT
#

@discord.app_commands.checks.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check "discord.app_commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the permissions given by [`discord.Interaction.permissions`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.Interaction.permissions "discord.Interaction.permissions").

The permissions passed in must be exactly like the properties shown under [`discord.Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions").

This check raises a special exception, [`MissingPermissions`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.MissingPermissions "discord.app_commands.MissingPermissions") that is inherited from [`CheckFailure`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CheckFailure "discord.app_commands.CheckFailure").

New in version 2.0...
digital charm
#

The code:

#balanace:
@client.command(aliases=['bal'])
async def balance(ctx):

  with open("balance.json", "r") as bal:
    
    user = ctx.author
    users = await get_balance_data()
    balance = users[str(user.id)]["balance"] = 0
    
    embedbalance = discord.Embed(titles=f"{ctx.author.name}'s balance", color=discord.Color.blue())
    embedbalance.add_field(name="balance", value=balance)
    await ctx.send(embed=embedbalance)
  
  
async def get_balance_data():
  
  with open("balance.json", "r+") as bal:
    users = json.loads(bal.read())
    json.dump(users, bal)

Error:

JSONDecodeError: Expecting value: line 1 column 1 (char 0)
silk fulcrum
#

oh wait he uses pycord

slate swan
placid skiff
regal pulsar
#

Lmao

ashen perch
#

i also found this extension which is really good stops me wasting time doing the boring stuff

placid skiff
#

imagine using two different checks for app commands and standard one

#

ew

slate swan
eager shuttle
slate swan
#

pip install discord

#

xd

#

and don't create your bot.py inside the venv!!!

ashen perch
eager shuttle
ashen perch
#

i had to do pip3.10 install discord as it didnt work althouwise

placid skiff
#

bruh pycharm has a terminal for python and pip D_D

#

the problem is that he is using a venv and probably using the pip command outside of that venv

eager shuttle
#

ill try that

slate swan
regal pulsar
#

That extension is terrible

placid skiff
slate swan
#

like ```py
if discord.member has perm(administrator=true)

slate swan
placid skiff
#

bruh D_D

slate swan
#

um

eager shuttle
#

still doesnt work

slate swan
placid skiff
#
@command(name="ban")
@has_permissions(administrator=True)
async def ban(ctx: discord.ext.commands.Context, user: discord.Member):
  #your stuff

#somewhere else
@Cog.listen()
async def on_command_error(ctx: discord.ext.commands.Context, error):
  if isinstance(error, discord.MissingPermissions):
    ctx.send("you don't have the permissions to use this command")
slate swan
#

Bruh

placid skiff
#

yup

slate swan
#

You made all by your self?

placid skiff
#

yup D_D

slate swan
#

a

#

Html

#

aaaa ok Have Nice day!

#

22 YEARS WTF

#

lol

placid skiff
slate swan
#

I 13 OMG xD

#

xDD

#

wait

#

ME DUNMB

#

xd

silk fulcrum
#

@placid skiff wow, u 22 years :lmao: :kek: :noway_bruh:

slate swan
#

ah

vale wing
silk fulcrum
slate swan
vale wing
#

Oh yeah

silk fulcrum
#

he is DUNMB

slate swan
silk fulcrum
#

how did u know btw?

slate swan
#

oh rip

vale wing
#

Cat face literally

mossy jacinth
#

how can i generate a random number that is always 16 digits long?

silk fulcrum
slate swan
#

i have cameras Every where >:)

vale wing
placid skiff
vale wing
#

You could generate like hex stuff

slate swan
silk fulcrum
slate swan
#

o

mossy jacinth
slate swan
#

this like java bruh

mossy jacinth
#

English is not my main language so mb

slate swan
slate swan
#

but i have

#

so i can traslte it to arabic xD

vale wing
unkempt canyonBOT
#

@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.

1591381678124602
silk fulcrum
mossy jacinth
#

💀

slate swan
#

LOL

vale wing
slate swan
#

Really i glad to hear that

silk fulcrum
slate swan
#

Can any one help D:

slate swan
hazy oxide
#

send code

slate swan
#
@bot.slash_command(name='channel', description="lock Or UnLock The Channel!")
@has_permissions(administrator=True)
async def channel(ctx, mode):
        if mode == "lock" or "Lock":
            perms = ctx.channel.overwrites_for(ctx.guild.default_role)
            perms.send_messages=False
            await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=perms)
            await ctx.send(f'**Channel Locked!**')
        if mode == "unlock" or "Unlock" or "UnLock" or "unLock":
            perms = ctx.channel.overwrites_for(ctx.guild.default_role)
            perms.send_messages=True
            await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=perms)
            await ctx.send(f'**Channel UnLocked!**')```
mossy jacinth
# slate swan

from discord.ext.commands import has_permissions, MissingPermissions

#

i think

slate swan
#

o

#

it work but cog???

silk fulcrum
slate swan
#
@Cog.listen()
async def on_command_error(ctx: discord.ext.commands.Context, error):
  if isinstance(error, discord.MissingPermissions):
    ctx.send("you don't have the permissions to use this command")```
mossy jacinth
#

i think it should work in cogs

slate swan
#

a

vale wing
#

z

#

Alphabet 😀 👍

slate swan
hazy oxide
#

what lib did u use?

mossy jacinth
hazy oxide
#

oh it's discord

slate swan
hazy oxide
#

import commands from discord.ext

slate swan
#

from discord.ext import commands

hazy oxide
#

then do this

silk fulcrum
vale wing
slate swan
vale wing
#

It's where you get books

silk fulcrum
#

gah im never right

slate swan
hazy oxide
#

oh nextcord

slate swan
slate swan
silk fulcrum
slate swan
#

xD

#

now

#

cog???

#

i just do that Xd

#

@hazy oxide

#

aaaa or @placid skiff

hazy oxide
#

im not using cogs, so idk

placid skiff
#

Cog is a way to connect more files of your bot D_D

vale wing
#

More like commands container

slate swan
vale wing
#

And listeners

hazy oxide
vale wing
#

Even loops

slate swan
#

ok

placid skiff
slate swan
#

0************************************************************

placid skiff
#

Just use your bot instance bot.listener()

silk fulcrum
slate swan
#

SO I USE listen() or bot.listener() THIS SO WERIDO THINgs

placid skiff
#

Yup listen

slate swan
#

pok

#

ah

#

i will import listen?

vale wing
#

What's your native language @slate swan

slate swan
slate swan
vale wing
#

Understandable

slate swan
#

Um My english not that bad

#

my sister is going england to study there english cambrigh so xD

#

me still small D;

meager chasm
slate swan
#

xD

tawdry karma
#

Oh god

slate swan
#

xD Hi angad

tawdry karma
slate swan
#

true

#

my spell is good

#

very fast at typing

#

and we in wrong channel

tawdry karma
slate swan
#

grammer is trash

slate swan
placid skiff
slate swan
#

really angad

tawdry karma
#

haha

slate swan
placid skiff
#

event and listen both dispatch an event, but with event only the first one executed will be resolved

slate swan
#

oh

meager chasm
#

event overrides the bot internal method too

#

listen doe not

placid skiff
#

instead, listeners will always be resolved

slate swan
#

so what i import

slate swan
slate swan
slate swan
placid skiff
#

you don't import nothing

#

you'll need to use the bot instance

slate swan
#

it make error if i don't import

maiden fable
#

@slate swan your name- ImportError: module Life has no attribute Friendship

dull moon
#

how to edit embed multiple times ?

slate swan
#

messsage = ctx.send(embed=embed)

#

xD

slate swan
meager chasm
placid skiff
#

bruh, bot.listen()

slate swan
#

ez thank byeee

rugged shadow
#

ez lmao

slate swan
#

oh work

slate swan
slate swan
meager chasm
#

no boot

tawdry karma
#

LOL

slate swan
#

bruh it not work

silk fulcrum
slate swan
meager chasm
rugged shadow
silk fulcrum
slate swan
placid skiff
#

If you are the owner of the server you've all permissions D_D

slate swan
meager chasm
#

Then how it will send

slate swan
#

in your dreams

tawdry karma
#

💀

slate swan
meager chasm
#

What 👎

slate swan
#
@bot.slash_command(name='channel', description="lock Or UnLock The Channel!")
@commands.has_permissions(administrator=True)
async def channel(ctx, mode):
        if mode == "lock" or "Lock":
            perms = ctx.channel.overwrites_for(ctx.guild.default_role)
            perms.send_messages=False
            await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=perms)
            await ctx.send(f'**Channel Locked!**')
        if mode == "unlock" or "Unlock" or "UnLock" or "unLock":
            perms = ctx.channel.overwrites_for(ctx.guild.default_role)
            perms.send_messages=True
            await ctx.channel.set_permissions(ctx.guild.default_role, overwrite=perms)
            await ctx.send(f'**Channel UnLocked!**')
bot.listen()
async def on_command_error(ctx: discord.ext.commands.Context, error):
  if isinstance(error, discord.MissingPermissions):
    await ctx.send("you don't have the permissions to use this command")```
slate swan
meager chasm
#

It is slash command so how it will go to on_command_error

slate swan
placid skiff
#

and bot.listen is a deco

slate swan
#

@placid skiff Badddd 👎

#

xD jk

placid skiff
#

You didn't tell that it was a slash command D_D

meager chasm
#

!d discord.app_commands.CommandTree

unkempt canyonBOT
#

class discord.app_commands.CommandTree(client, *, fallback_to_global=True)```
Represents a container that holds application command information.
slate swan
meager chasm
#

Go there and see what method is for error handling

slate swan
tawdry karma
#

b r u h

slate swan
meager chasm
tawdry karma
slate swan
slate swan
meager chasm
slate swan
slate swan
placid skiff
#

decorators are functions that take another function as argument, to use them you do @deco

meager chasm
#

You need to know classes to read docs , u should learn them

dense coral
slate swan
#

ok

slate swan
#

ah

#

so what i do dumbfudge

tawdry karma
tawdry karma
slate swan
slate swan
tawdry karma
slate swan
#

where dms

tawdry karma
#

And you used classes for buttons

slate swan
#

what school mean

#

and home mean

#

what i am mean B_CoolBlob

#

i feel everyone dead

near nymph
#

How to make loop

meager chasm
#

u can get the CommandTree instance from bot.tree

dense coral
shrewd apex
meager chasm
shrewd apex
#

boots 👀pithink

meager chasm
#

u can kick ppl with them

shrewd apex
#

yesh

meager chasm
meager chasm
#

for loop? while loop?

placid skiff
#

!d discord.ext.tasks.Loop

unkempt canyonBOT
#

class discord.ext.tasks.Loop```
A background task helper that abstracts the loop and reconnection logic for you.

The main interface to create this is through [`loop()`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.loop "discord.ext.tasks.loop").
slate swan
#

hi

meager chasm
#

discord.ext.tasks.loop?

slate swan
meager chasm
shrewd apex
#

blvck master in understanding context from stuff pithink

meager chasm
#

do u want youtube guide on classes

placid skiff
#

lmao

shrewd apex
#

mhm ducky_wizard

slate swan
meager chasm
slate swan
#

Um

#

just send me code and i will understand i do this in everything :D

slate swan
#

even ask @tawdry karma but he dead rn D:

meager chasm
#

because u r lazy

shrewd apex
#

spoonfeed me i will tell u how it tastes

slate swan
meager chasm
#

dont want to learn classes

slate swan
meager chasm
#

only want spoonfeeding like weee weee baby

dense coral
slate swan
#

i every oone send me code and i understand

slate swan
meager chasm
slate swan
#

i not joking bruh

meager chasm
#

then u need to learn python so u can understand

dull moon
#

can i change the "{BotName} is thinking" message

slate swan
meager chasm
meager chasm
dull moon
slate swan
dull moon
slate swan
#

it eeasy

meager chasm
#

InteractionResponse.send_message returns Message obj, you can put that in variable and edit when you need to

slate swan
#

;/ stop ignore me

#

D; me sad

meager chasm
#

first u stop ignore me

slate swan
meager chasm
#

wtf

slate swan
#

like this:D

#

idk dude you send code and i understand

meager chasm
#

im not helping u anymore u dont even listen to what im saying

slate swan
#

this how i learn skript and java

slate swan
meager chasm
#

u not "learn" anything lol u just gluing togther code

meager chasm
slate swan
silk fulcrum
placid skiff
slate swan
#

really

#

i will not learn anything ;/

#

my way to learn take code read it and learn ;/

meager chasm
#

then cry lol

#

we r not going to spoonfeed u

slate swan
meager chasm
#

u either learn or keep begging

slate swan
meager chasm
#

dont care lol

slate swan
slate swan
silk fulcrum
#

go ahead

slate swan
#

o bye

silk fulcrum
meager chasm
#

ahaha xdd

placid skiff
#

lmao

slate swan
meager chasm
#

i say u to learn so u can understand me, how that is disrespect xdd

silk fulcrum
slate swan
#

but with coding way

slate swan
#

then i ping stuff

meager chasm
#

yes i dont care about ur whininhg

silk fulcrum
#

people are trying to help and you are just yelling saying that u wont learn anything you want to be spoonfeeded and you will understand the code

slate swan
#

for disrespectful

rugged shadow
#

they are doing this so we can ensure you actually learn, not just steal code and put it in your codebase

slate swan
meager chasm
#

u r frm egypt?

silk fulcrum
slate swan
slate swan
shrewd apex
#

hmm so when ur teacher gives u question paper in exam do u say give answer key first then I'll studying for exam💀

meager chasm
#

how usa education system is so trash

slate swan
#

i not 101% know all english

meager chasm
#

when i said anything about english

silk fulcrum
slate swan
slate swan
slate swan
slate swan
meager chasm
#

in usa education system teacher do all homework fr student?

slate swan
#

now be quiet me want read @placid skiff code

rugged shadow
silk fulcrum
meager chasm
#

he say usa

silk fulcrum
#

ohok

slate swan
#

no canada

#

uk

#

russia

silk fulcrum
#

france

slate swan
#

now be quiet

hollow badger
#

If you can't be civil you should take a break

slate swan
rugged shadow
silk fulcrum
slate swan
#

stop ping me

meager chasm
#

i think he is lying about age im pretty sure he is not allow on discord

silk fulcrum
placid skiff
# slate swan now be quiet

https://www.youtube.com/watch?v=F1HbEOp-jdg&list=PLYeOw6sTSy6ZGyygcbta7GcpI8a5-Cooc
Here, follow him
From so far this is one of the best tutorials i have ever saw

Welcome to the updated discord.py series - the series where I teach you how to build a discord.py bot for your server! Below are some links to get you started.

Series requirements can be found here:
https://files.carberra.xyz/requirements/discord-bot-2020

You'll also need an IDE; I use Sublime Text in this series:
https://www.sublimetext.com/
...

▶ Play video
slate swan
#

oh i hope thats not the case :p

#

;/

#

i hate you guys stop ping me

placid skiff
slate swan
#

carberra's tutorials are actually nice :p

rugged shadow
silk fulcrum
#

well, yeah, no lies

slate swan
#

Oh i got point

rugged shadow
slate swan
#

bc it slash_command we can't use bot._listen

slate swan
rugged shadow
silk fulcrum
slate swan
slate swan
ashen perch
silk fulcrum
slate swan
#

ok bye now :D

slate swan
#

xD

#

so i can't just be respectful and them not

silk fulcrum
meager chasm
#

noone is making joke of u we are just asking u to learn the basics so u can understand what we r saying to you

shrewd apex
#

we are already civil u should try this in dpy server

slate swan
#

i feel we chating about who will start war3

rugged shadow
hollow badger
#

!shhh

unkempt canyonBOT
#

✅ silenced current channel for 6 minute(s).

hollow badger
#

Things need to settle down. Please stick to the channel topic. Any more disruptive or insulting behaviour is not acceptable.

#

!unshhh

unkempt canyonBOT
#

✅ unsilenced current channel.

slate swan
#

what

rugged shadow
#

ok mr mod thanks uwu

#

.topic now

lament depotBOT
#
**What's one feature you wish more developers had in their bots?**

Suggest more topics here!

meager chasm
rugged shadow
#

These topics are ass bro, there are probably only 4

meager chasm
#

they like giving code for free

slate swan
hollow badger
slate swan
#

this kinda explane what is going on

rugged shadow
slate swan
meager chasm
#

they will give u full code

slate swan
#

nope

#

i will stay here

meager chasm
#

yes they r much nicer ppl than us

rugged shadow
slate swan
hollow badger
meager chasm
#

they even give candy if u ask nicely

slate swan
#

lol

slate swan
slate swan
#

now be quiet good bye everyone!

slate swan
#

yes all of them use the same code

#

disnake

#

you know what

#

i will work in other thing :D

meager chasm
#

ok

#

good bye

slate swan
#

great.

silk fulcrum
#

I'm not going to school tomorrow 🎉
I can code my bot freely... well only for one more day, but still cool

rugged shadow
#

my teacher announced that tomorrow will be online class, but they changed it

slate swan
#

im not going to school either but I can't code.for a year.

placid skiff
#

bruh you start school on first september? lmao

silk fulcrum
slate swan
#

oh xD i forget school start in Eu countrys

slate swan
#

a perfect time to abandon all my projects

slate swan
vocal snow
rugged shadow
vocal snow
#

tyy :D

slate swan
slate swan
rugged shadow
slate swan
#

dude i so lucky me have 5 month hoilday Joy3D

silk fulcrum
slate swan
#

i did some thing like this

rugged shadow
#

ah 👁️ 👀

slate swan
#

off-topic anyways

rugged shadow
#

like eye and see

#

you know "i see" right

slate swan
#

i see

rugged shadow
#

like it sounds like that

slate swan
#

like this

vocal snow
silk fulcrum
slate swan
#

ah

silk fulcrum
#

(eye eyes)

slate swan
#

and this

#

so ye i can code :D

rugged shadow
slate swan
#

it activity

#

chnage stream activity to name and link

rugged shadow
#

cool

slate swan
#

lol

slate swan
rugged shadow
#

your bot uses slash commands as I see though

slate swan
#

and this !user

rugged shadow
#

or maybe that's a hybrid

slate swan
#

so some !

#

and some /

rugged shadow
slate swan
#

um i still changes

rugged shadow
#

you should be consistent and choose one for all of your commands

slate swan
slate swan
rugged shadow
placid skiff
slate swan
#

this loop for amout of times right? py for i in range(count):

placid skiff
#

hikari has a deco that set a command bot as slash and chat one

slate swan
#

count is amout of time

slate swan
rugged shadow
rugged shadow
slate swan
#

but when i put it in this code py @bot.slash_command(name='count', description="Make Bot Count Until A Number!") async def count(ctx, mode: str, number: int): if (mode) == 'down': await ctx.channel.purge(limit=1) editmessage = await ctx.send(f'OK We Will Count Until **{number}**') (count2) = 1 for i in range(count): sleep(1) await editmessage.edit(content=f'**{count2}**') (count2) = (count2) + 1 sleep(1) await ctx.send (f'OK I Count To **{number}**') if (mode) == 'up': await ctx.channel.purge(limit=1) editmessage = await ctx.send(f'OK We Will Count Until **{number}**') (count2) = (count) for i in range(count): sleep(1) await editmessage.edit(content=f'**{count2}**') (count2) = (count2) - 1 sleep(1) await ctx.send (f'OK I Count To **{count}**') the loop not work and it give me error

#

and before change it from ! to / it was working

#

so idk why

silk fulcrum
slate swan
#

it say i isn't integer

#

time.sleep is bad 🛑

rugged shadow
slate swan
rugged shadow
#

and please use asyncio.sleep instead of time.sleep, it's blocking

rugged shadow
slate swan
#

ok

rugged shadow
#

if you're using VSCode, Ctrl+Shift+R

slate swan
#

yeah stay lazy, your bot will stay lazy as well

#

so asyncio.sleep(1)

silk fulcrum
rugged shadow
slate swan
#

await asyncio.sleep

rugged shadow
#

ctrl+r for one file

slate swan
#

await asyncio.sleep(1)?

rugged shadow
silk fulcrum
#

he'll be lazy

slate swan
rugged shadow
slate swan
slate swan
rugged shadow
#

etzeitet is watching

slate swan
#

it shut up but nice way

#

sure.

#

hi etzeitet

rugged shadow
#

"shut up but nice way" i don't see how that's nice

#

it has the same meaning

slate swan
#

at this point of time, yea

#

ah

rugged shadow
#

lmao

slate swan
#

i mean !shh by shh

slate swan
rugged shadow
slate swan
#

i have /channel lock in my bot :D

rugged shadow
rugged shadow
#

that's even worse than "shut up"

slate swan
#

NOW STOP BE DISRESPECTFUL TO EVERYONE THAT TRY GET HELP | bye don't ping me :D

#

i don't do bots anymore but the last one i made had just 5-6 commands

slate swan
silk fulcrum
rugged shadow
slate swan
silk fulcrum
rugged shadow
#

hee hee

#

i got the role

silk fulcrum
#

that is just not possible

tawdry karma
rugged shadow
silk fulcrum
#

RIP in piece

#

oh wait

#

bruh

tawdry karma
slate swan
silk fulcrum
slate swan
tawdry karma
#

im reading through all the old messages right now

slate swan
#

why no one tell me that ;/

slate swan
tawdry karma
slate swan
#

me need read rules

slate swan
tawdry karma
slate swan
#

you get blocked

tawdry karma
slate swan
#

ANGAD USING TIME.sleep(1)

#

HE MURDER

silk fulcrum
#

where

slate swan
silk fulcrum
#

prove its his code?

tawdry karma
#

use asyncio then

slate swan
#

HE NOOB xD

tawdry karma
#

i made that in 3 minutes

silk fulcrum
#

says noob

slate swan
#

YOU USE SLEEP(1) LOPL

tawdry karma
#

and your using my code

slate swan
slate swan
#

now bye

#

ping me = block for 1 year

tawdry karma
#

LOL

silk fulcrum
#

bye

tawdry karma
#

bye

silk fulcrum
slate swan
#

um

tawdry karma
#

...

slate swan
#

if i block you i can't get help D:

#

so you not blocked :D

#

por what

#

nope blocked to be fair

silk fulcrum
#

nice

slate swan
#

good who next

slate swan
tawdry karma
#

lol

slate swan
tawdry karma
#

RIP

slate swan
#

jk hard block angad

silk fulcrum
slate swan
#

only when he ping me 69 itmes

slate swan
tawdry karma
#

NO

slate swan
#

xD

#

i make wrong move xD

tawdry karma
#

you just pinged the mods for that

slate swan
#

just let them ban me i have 10 other acounts

silk fulcrum
#

aight then imma go code my RPS, i've still not done it bruh🚶‍♂️

#

gl guys

tawdry karma
#

wait what ban evasion isn't bannable roc_eyebrowraised

#

where do i recommend that...

hollow badger
#

Why were mods pinged?

slate swan
hollow badger
#

Where?

slate swan
slate swan
#

Make your job Mod :D

hollow badger
#

I don't see a problem. Please only ping mods for an actual issue.

slate swan
#

;/

silk fulcrum
#

oh i thought i'll have a first punishment in this server

slate swan
#

he say congrats @tawdry karma this disrespectfuk ;/

silk fulcrum
#

ok gud im still clean :)

slate swan
#

;/

slate swan
hollow badger
#

I think you need to take a break @slate swan. You're the common denominator in all the bickering today.

slate swan
#

YOU Can't JUST KEEP HIM AND HE BROKEN RULES

tawdry karma
#

Oh wow.

silk fulcrum
slate swan
silk fulcrum
#

tell me, if that's true, ill punish myself

slate swan
#

um congrats @tawdry karma?

hollow badger
#

!mute @slate swan 12h Please take a break.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1661981096:f> (12 hours).

silk fulcrum
#

oh thanks

near nymph
#

um

#

rude to mute me

#

i say i have 10 accounts

near nymph
silk fulcrum
tawdry karma
#

Oh no

near nymph
hollow badger
#

!ban 1001147045274464386 mute evasion.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @near nymph permanently.

loud junco
#

huh

#

what on earth happened today

#

so many ban and mute

tawdry karma
#

Someone caused a little disruption. I won't go into details ¯_(ツ)_/¯

tawdry karma
meager chasm
#

so his main prolly not be able to access server

tawdry karma
#

@slate swan

meager chasm
#

breaking so many rules and all he gets is a mute

tawdry karma
#

Oh

#

He is watching right now btw

meager chasm
#

ik he dm me "L" xd

keen talon
#

.topic

lament depotBOT
#
**What unique features does your bot contain, if any?**

Suggest more topics here!

silk fulcrum
tawdry karma
#

NOT LIKE yygragsil

#

or whatever its called

placid skiff
#

Oh the guy was muted D_D

shrewd apex
#

ban is ip ban in discord so he can join again only with vpn

placid skiff
#

ip address changes when you restart your modem, unless you have set a static ip address

shrewd apex
#

and for some reason my discord client doesn't work if i have vpn on sometimes so its a pain in the ass

#

yesh that too

glad cradle
#

discord web 👀

meager chasm
cerulean shale
#

but nothing happened ffs

slate swan
#

So I put the same code in replit, and in bot-hosting.net, in replit it worked fine, but in the other one I got his error:```py
Traceback (most recent call last):
File "/home/container/bot.py", line 5, in <module>
from cogs.services import tickets, ticket_closes
File "/home/container/cogs/services.py", line 25
(*[discord.ui.InputText(style = discord.InputTextStyle.long, label = i[0], placeholder = i[1], min_length = 2) for i in questions[ttype]]),

SyntaxError: cannot use starred expression here

jaunty sequoia
#

i have a question, is it possible to run a discord bot scrip running 24/7 without having to make a server for it?

slate swan
#

#965291480992321536 you host it ( and you're not getting any good free option without a credit card)

slate swan
# glad cradle show line 25

It's in the error```py
(*[discord.ui.InputText(style = discord.InputTextStyle.long, label = i[0], placeholder = i[1], min_length = 2) for i in questions[ttype]]),

slate swan
#

go to startup, and choose python 3.9 or 3.10 as your image

#

Thanks

#

It's already at 3.10 tho

jaunty sequoia
slate swan
#

2.10? 🤨

#

thats like 10 years something old

#

3.10

glad cradle
#

as the error says

digital charm
#

Error:
UnboundLocalError: local variable 'member' referenced before assignment
Code:

async def balance(ctx, user:discord.User=None):
  if user is None:
    user = ctx.author

  db = sqlite3.connect('ab.sqlite')
  cb = db.cursor()

  cb.execute[f"SELECT Yen from ab WHERE user_id = {u.id}"]

  bal = cb.fetchone()
  try:
      Yen = bal[0]

  except:
    Yen = 0

    await ctx.send(f"Yen: {Yen}")

slate swan
#

member or user? be consistent

#

and its discord.Member , not discord.member

digital charm
glad cradle
#

if member is None you have user as parameter not member

placid skiff
#

and it is discord.Member

digital charm
slate swan
#

What does SyntaxError: cannot use starred expression here mean?

#
  • is not usable in that context
#

haven't used the host so can't say, mind sending the full exception and related code?

#

or is that all

#
ValueError: could not find open space for item``` what is the fix to this error?
slate swan
#

!d discord.ui.Modal

unkempt canyonBOT
#

class discord.ui.Modal(*, title=..., timeout=None, custom_id=...)```
Represents a UI modal.

This object must be inherited to create a modal popup window within discord.

New in version 2.0.

Examples...
slate swan
#

hm, it doesn't take any TextInputs

#

what library are you using

#

py-cord==2.0.0

#

what's the limit for discord modals questions?

digital charm
#

Code:


from event import Event

intents = discord.Intents.all()
bot = commands.Bot(command_prefix = 'a ', intents=intents, case_insensitive=True)


async def setup(bot):
    await bot.add_cog(Event(bot))

@bot.event
async def on_ready():
  await bot.change_presence(status=discord.Status.online, activity=discord.Game('Anime Botto'))
  print('Logged in as {0.user}'.format(bot))


@bot.command()
async def balance(ctx, user:discord.User=None):
  if user is None:
    user = ctx.author

  db = sqlite3.connect('ab.sqlite')
  cb = db.cursor()

  cb.execute(f"SELECT Yen from ab WHERE user_id = {user.id}")

  bal = cb.fetchone()
  try:
      Yen = bal[0]

  except:
    Yen = 0

    await ctx.send(f"Yen: {Yen}")

Error:
OperationalError: no such table: ab