#Allgemeine Hilfe

1 messages ยท Page 57 of 1

tawdry leaf
#

ich benutze eine variable dazu

ban_count = 0

for for row in rows:
ban_count +=1

limber crow
#

Wieso kommt der fehler ?

Traceback (most recent call last):
  File "C:\Users\YT197\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 777, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "c:\Users\YT197\Desktop\Allgemein\Dev\Discord\Pycord\Ninja Dojo (Public Bot)\cogs\Admin\clear.py", line 10, in <module>
    class ClearCommand(commands.Cog):
  File "c:\Users\YT197\Desktop\Allgemein\Dev\Discord\Pycord\Ninja Dojo (Public Bot)\cogs\Admin\clear.py", line 15, in ClearCommand
    @commands.default_permissions(manage_messages=True)
AttributeError: module 'discord.ext.commands' has no attribute 'default_permissions'. Did you mean: 'has_permissions'?

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

Traceback (most recent call last):
  File "c:\Users\YT197\Desktop\Allgemein\Dev\Discord\Pycord\Ninja Dojo (Public Bot)\main.py", line 4, in <module>
    bot = Bot()
  File "c:\Users\YT197\Desktop\Allgemein\Dev\Discord\Pycord\Ninja Dojo (Public Bot)\bot.py", line 14, in __init__
    self.load_cogs("cogs", subdirectories=True)
  File "C:\Users\YT197\AppData\Local\Programs\Python\Python310\lib\site-packages\ezcord\bot.py", line 240, in load_cogs
    self.load_extension(f"{'.'.join(path.parts)}.{dirname}.{name}")
  File "C:\Users\YT197\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 913, in load_extension
    self._load_from_module_spec(spec, name)
  File "C:\Users\YT197\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\cog.py", line 780, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.Admin.clear' raised an error: AttributeError: module 'discord.ext.commands' has no attribute 'default_permissions'

Code

from datetime import datetime

import discord
import asyncio
from discord.ext import commands
from discord.commands import slash_command
from discord import File


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

    @slash_command(description="Lรถsche Nachrichten")
    @commands.default_permissions(manage_messages=True)
    @commands.bot_has_permissions(manage_messages=True)
    async def clear(self, interaction: discord.Interaction, zahl: int, grund: str):
        await interaction.response.defer()

        if zahl <= 0:
            await interaction.channel.send("Die Anzahl der zu lรถschenden Nachrichten muss grรถรŸer als 0 sein.")
            return

        messages = await interaction.channel.history(limit=zahl + 1).flatten()
        await interaction.channel.delete_messages(messages)

        embed = discord.Embed(
            title="Nachrichten gelรถscht",
            description=f"Es wurden {zahl} Nachrichten von {interaction.user.mention} gelรถscht.",
            color=discord.Color.orange(),
            timestamp=datetime.now()
        )
        embed.add_field(name="Grund", value=grund, inline=False)

        thumbnail_path = "img/Mรผlleimer.png"
        thumbnail_file = File(thumbnail_path, filename="thumbnail.png")
        embed.set_thumbnail(url="attachment://thumbnail.png")
        embed.set_footer(text=f"{interaction.guild.name}", icon_url=self.bot.user.avatar.url)

        msg = await interaction.channel.send(embed=embed, file=thumbnail_file)
        await asyncio.sleep(10)
        await msg.delete()


    @clear.error
    async def clear_error(self, interaction: discord.Interaction, error: commands.CommandError):
        if isinstance(error, commands.MissingPermissions):
            await interaction.response.send_message(
                "Du hast keine Rechte, um den Befehl zu benutzen", ephemeral=True
            )


def setup(bot):
    bot.add_cog(ClearCommand(bot))
urban glen
#

Steht auch in den #๐Ÿ”ฐใƒปold-help-rules btw

twilit anvil
limber crow
#

AuรŸerdem geht es um einen Error wegen default_permissions und das mรถchte ich fixen

urban glen
#

@discord.default_permissions

#

nicht @commands.default_permissions

limber crow
#

Oh

limber crow
solid ingot
urban glen
#
ceback (most recent call last):
  File "C:\Users\melvi\PycharmProjects\luckysbot\main.py", line 4, in <module>
    import ezcord
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\ezcord\__init__.py", line 7, in <module>
    from .bot import *
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\ezcord\bot.py", line 11, in <module>
    from discord.ext import bridge, commands
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\bridge\__init__.py", line 26, in <module>
    from .bot import *
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\bridge\bot.py", line 34, in <module>
    from .context import BridgeApplicationContext, BridgeExtContext
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\bridge\context.py", line 30, in <module>
    from discord.commands import ApplicationContext
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\__init__.py", line 27, in <module>
    from .core import *
  File "C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 49, in <module>
    from ..enums import MessageType, SlashCommandOptionType, try_enum
ImportError: cannot import name 'SlashCommandOptionType' from 'discord.enums' (C:\Users\melvi\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\enums.py)```

Ich hba eein Ezcord Fehler
odd kiteBOT
fierce dove
#
Ignoring exception in modal <cogs.Owner.sup.SupportModal object at 0xe40fab50>:
Traceback (most recent call last):
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Owner/sup.py", line 360, in callback
    target_guild = interaction.get_guild(target_guild_id)
                   ^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Interaction' object has no attribute 'get_guild'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/ui/modal.py", line 341, in dispatch
    await value.callback(interaction)
  File "/storage/emulated/0/Timo/Dev/Discord/Bot/Falci/cogs/Owner/sup.py", line 460, in callback
    await interaction.response.send_message(f"Ein Fehler ist aufgetreten: {str(e)}")
  File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/discord/interactions.py", line 844, in send_message
    raise InteractionResponded(self._parent)
discord.errors.InteractionResponded: This interaction has already been responded to before
fierce dove
# fierce dove ```py Ignoring exception in modal <cogs.Owner.sup.SupportModal object at 0xe40fa...
class SupportModal(discord.ui.Modal):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.add_item(discord.ui.InputText(label="Wie kรถnnen wir dir Helfen", style=discord.InputTextStyle.long, min_length=0, max_length=2500))

    async def callback(self, interaction: discord.Interaction):
        print(self.Eingabe.value)
        try:
            await interaction.response.send_message("Modal callback executed successfully.")
            target_guild_id = 1060636199070474303
            target_guild = self.interaction.get_guild(target_guild_id)
mystic flower
#

    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect("connection.db") as db:
            await db.execute("""
                CREATE TABLE IF NOT EXISTS UTIME (
                Name TEXT PRIMARY KEY,
                user_id INTEGER,
                steam_id TEXT NOT NULL,
                )
                """
            )
            await db.commit()```
#

WeiรŸ jemand warum das so ist?

mystic flower
#

Danke

#
async def connect(self, name, userid, steamid):
    async with aiosqlite.connect("connection.db") as db:
        await db.execute(
            """
            INSERT INTO UTIME(
            username, 
            user_id, 
            steam_id 
           ) VALUES (?, ?, ?)
            """
        )
        await db.commit()```
#
 @slash_command()
    async def sync(self,ctx,  steamid: Option(str, "Gibt deine Steamid an")):
        member = ctx.author
        await connect(member.name, member,id, steamid)
        await ctx.respond("Done", ephemeral=True)```
urban glen
#
async def connect(self, name, userid, steamid):
    async with aiosqlite.connect("connection.db") as db:
        await db.execute(
            """
            INSERT INTO UTIME(
            username, 
            user_id, 
            steam_id 
           ) VALUES (?, ?, ?)
            """, (name, userid, steamid)
        )
        await db.commit()
#

@mystic flower

Hast vergessen den namen, userid und steamid einzutragen

#

Ghost Ping

solid ingot
#

interaction.get_guild gibt es nicht

#

such mal in den docs nach get_guild

odd kiteBOT
fierce dove
#

fetch_guild

urban glen
mystic flower
#
    @slash_command()
    async def steamid(self, ctx):
        member = ctx.author
        username = member.name
        userid= member.id
        steam=await get_steamid(username, userid)
        await ctx.respond(steam)
async def get_steamid(username, userid):
    async with (aiosqlite.connect("connection.db") as db):
        await db.execute(
            """
            SELECT steam_id FROM UTIME WHERE user_id = ?
            """
        )```
urban glen
mystic flower
urban glen
#

Und jetzt steht im error das es keine Column namens "userid" gibt

mystic flower
#

ist doch in den Parametern

urban glen
mystic flower
#
    @commands.Cog.listener()
    async def on_ready(self):
        async with aiosqlite.connect("connection.db") as db:
            await db.execute("""
                CREATE TABLE IF NOT EXISTS UTIME(
                username TEXT PRIMARY KEY,
                user_id INTEGER,
                steam_id TEXT NOT NULL
                )
                """
            )
urban glen
#

...

#

Lern die SQL Grundlagen

mystic flower
#

...

urban glen
#

Ich habs dir jetzt 2 mal gesagt

#
async def get_steamid(username, userid):
    async with (aiosqlite.connect("connection.db") as db):
        await db.execute(
            """
            SELECT steam_id FROM UTIME WHERE userid = ?
            """, (userid, )
        )
limber crow
#

Gibt es nen event, dass getrickert wird, wenn ein User gebannt oder gekickt wird oder nicht ? (Frage wegen Kick, Bans, Timeouts und co logging in einem extra cog)

odd kiteBOT
solid ingot
#

fรผr kicks gibt es keine extra logs, das wird wird mit on_member_remove gemacht

odd kiteBOT
kind depot
#

Habe einen fehler im code aber weis nicht woo... Error beim Starten...

C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\cog.py:786: RuntimeWarning: coroutine 'setup' was never awaited
  setup(self)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
[COG] Loaded 11 cogs
Coin Bot#0606 ist online
[INFO] Bot is online with EzCord 0.3.6
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Bot           โ”‚ ID                 โ”‚ Pycord โ”‚ Commands โ”‚ Guilds โ”‚ Latency โ”‚
โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ Coin Bot#0606 โ”‚ 910524961007992903 โ”‚ 2.4.1  โ”‚ 24       โ”‚ 19     โ”‚ 147ms   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
fierce dove
#

Zeig Code

kind depot
#

von wo solll ich den code zeigen?

kind depot
#

pycord

urban glen
kind depot
urban glen
#

Meinte deinen Cog

limpid wolf
# kind depot

Bist du dir sicher das das die richtige Datei ist? PepeGiggleHehe

urban glen
#

Hab nicht gesehen das die cog.py von py-cord is

kind depot
limber crow
urban glen
kind depot
kind depot
urban glen
#

@kind depot schick mal deine packages

pip freeze

kind depot
# urban glen <@753974250968186901> schick mal deine packages `pip freeze`

absl-py==1.4.0
aiofiles==23.2.1
aiohttp==3.8.5
aiosignal==1.3.1
aiosqlite==0.19.0
annotated-types==0.5.0
anyio==3.7.1
asttokens==2.4.0
astunparse==1.6.3
async-class==0.5.0
async-timeout==4.0.3
attrs==23.1.0
backcall==0.2.0
beautifulsoup4==4.12.2
better-ipc==2.0.3
blinker==1.6.2
botocore==1.31.48
bs4==0.0.1
cachetools==5.3.1
certifi==2022.12.7
cffi==1.15.1
chardet==4.0.0
charset-normalizer==3.2.0
click==8.1.7
colorama==0.4.6
colored==2.2.3
contourpy==1.1.0
cycler==0.10.0
DateTime==5.2
decorator==5.1.1
discord==2.3.2
discord.py==2.3.2
elevenlabs==0.2.26
exceptiongroup==1.1.3
executing==2.0.0
ezcord==0.3.6
fastapi==0.103.1
feedparser==6.0.10
filelock==3.12.4
fire==0.5.0
Flask==3.0.0
flatbuffers==23.5.26
fonttools==4.42.1
frozenlist==1.4.0
fsspec==2023.9.0
gast==0.4.0
gevent==23.9.1
gitdb==4.0.10
GitPython==3.1.36
google-auth==2.23.0
google-pasta==0.2.0
google-re2==1.1
greenlet==3.0.0rc3
grpcio==1.58.0
h11==0.14.0
h2==4.1.0
h5py==3.9.0
hpack==4.0.0
httpcore==0.18.0
httpx==0.25.0
huggingface-hub==0.17.1
hypercorn==0.14.4
hyperframe==6.0.1
idna==2.10
imageio==2.31.3
ipython==8.16.1
itsdangerous==2.1.2
jedi==0.19.1
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.3.2
keras==2.13.1
kiwisolver==1.4.5
lazy_loader==0.3
libclang==16.0.6
loguru==0.7.2
Markdown==3.4.4
MarkupSafe==2.1.3
matplotlib==3.8.0
matplotlib-inline==0.1.6
mpmath==1.3.0
multidict==6.0.4
networkx==3.1
ninja==1.11.1
nltk==3.8.1
numpy==1.24.3
oauthlib==3.2.2
opencv-python==4.8.0.76
opencv-python-headless==4.8.0.74
opt-einsum==3.3.0
outcome==1.2.0
packaging==23.1
pandas==2.1.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.5.0
playwright==1.37.0
priority==2.0.0
prompt-toolkit==3.0.39
protobuf==4.24.3
psutil==5.9.5
pure-eval==0.2.2
py-cord==2.4.1
py-cpuinfo==9.0.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pybboxes==0.1.6
pyclipper==1.3.0.post5
pycparser==2.21
pydantic==2.3.0
pydantic_core==2.6.3
pydub==0.25.1
pyee==9.0.4
Pygments==2.16.1
PyNaCl==1.5.0
pyparsing==2.4.7
PySocks==1.7.1
pystyle==2.9
python-bidi==0.4.2
python-dateutil==2.8.2
python-dotenv==1.0.0
pytube==15.0.0
pytz==2023.3.post1
PyWavelets==1.4.1
PyYAML==6.0.1
Quart==0.19.2
regex==2023.8.8
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
rfc3986==1.5.0
rsa==4.9
safetensors==0.3.3
sahi==0.11.14
scikit-image==0.21.0
scikit-learn==1.3.0
scipy==1.11.2
scrapetube==2.5.1
selenium==4.12.0
sentencepiece==0.1.99
sgmllib3k==1.0.0
shapely==2.0.1
six==1.16.0
smmap==5.0.0
sniffio==1.3.0
sortedcontainers==2.4.0
soupsieve==2.5
SpeechRecognition==3.10.0
stack-data==0.6.3
starlette==0.27.0
sympy==1.12
tensorboard-data-server==0.7.1
tensorflow-estimator==2.13.0
tensorflow-io-gcs-filesystem==0.31.0
termcolor==2.3.0
terminaltables==3.1.10
terminut==0.0.0.931
threadpoolctl==3.2.0
tifffile==2023.8.30
tls-client==0.2.1
tokenizers==0.13.3
toml==0.10.2
torch==2.0.1
tqdm==4.66.1
traitlets==5.11.2
trio==0.22.2
trio-websocket==0.10.4
typing_extensions==4.7.1
tzdata==2023.3
urllib3==1.26.16
uvicorn==0.23.2
validators==0.20.0
veilcord==0.0.4.5
wavelink==2.6.4
wcwidth==0.2.8
webdriver-manager==4.0.0
websocket==0.2.1
websocket-client==1.6.3
websockets==11.0.3
Werkzeug==3.0.0
win32-setctime==1.1.0
wrapt==1.15.0
wsproto==1.2.0
yarl==1.8.2
zope.event==5.0
zope.interface==6.0

odd kiteBOT
#

@kind depot

Requirements-Check

โš ๏ธ Entferne alle Module aus der Python Standardbibliothek

DateTime==5.2```
โš ๏ธ Es sollte nur eine Discord Library installiert sein
```yml
discord==2.3.2
discord.py==2.3.2
py-cord==2.4.1```
*Ich habe [diese Nachricht](#1019974414487535736 message) geprรผft.*
kind depot
#

peepokay habe gerade neugestartet den bot... jz geht es wieder...

limber crow
kind depot
limber crow
twilit anvil
kind depot
#

danke

kind depot
limber crow
kind depot
#

ok

kind depot
#

... Weis nd was ich falsch mache... :c

PS E:\DATEIEN\PROGRAMIEREN\html\DASHBORD> & C:/Users/minec/AppData/Local/Microsoft/WindowsApps/python3.11.exe e:/DATEIEN/PROGRAMIEREN/html/DASHBORD/bot.py
C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ezcord\bot.py:223: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  self.load_extension(f"{'.'.join(path.parts)}.{name}")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ezcord\bot.py:241: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  self.load_extension(f"{'.'.join(path.parts)}.{dirname}.{name}")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
[COG] Loaded 11 cogs
C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ezcord\bot.py:518: RuntimeWarning: coroutine 'BotBase.load_extension' was never awaited
  self.load_extension(f".cogs.help", package="ezcord")
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
2023-10-22 17:09:47 INFO     discord.client logging in using static token
2023-10-22 17:09:48 INFO     discord.gateway Shard ID None has sent the IDENTIFY payload.
2023-10-22 17:09:49 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: 45401f099d2907d3350c42101827ff7b).
Coin Bot#0606 ist online
[INFO] Bot is online with EzCord 0.3.6
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Bot           โ”‚ ID                 โ”‚ Version โ”‚ Commands โ”‚ Guilds โ”‚ Latency โ”‚
โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
โ”‚ Coin Bot#0606 โ”‚ 910524961007992903 โ”‚ 2.3.2   โ”‚ 1        โ”‚ 19     โ”‚ 130ms   โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
kind depot
# vivid sky mach mal bitte pip freeze

absl-py==1.4.0
aiofiles==23.2.1
aiohttp==3.8.5
aiosignal==1.3.1
aiosqlite==0.19.0
annotated-types==0.5.0
anyio==3.7.1
asttokens==2.4.0
astunparse==1.6.3
async-class==0.5.0
async-timeout==4.0.3
attrs==23.1.0
backcall==0.2.0
beautifulsoup4==4.12.2
better-ipc==2.0.3
blinker==1.6.2
botocore==1.31.48
bs4==0.0.1
cachetools==5.3.1
certifi==2022.12.7
cffi==1.15.1
chardet==4.0.0
charset-normalizer==3.2.0
click==8.1.7
colorama==0.4.6
colored==2.2.3
contourpy==1.1.0
cycler==0.10.0
DateTime==5.2
decorator==5.1.1
discord==2.3.2
discord.py==2.3.2
elevenlabs==0.2.26
exceptiongroup==1.1.3
executing==2.0.0
ezcord==0.3.6
fastapi==0.103.1
feedparser==6.0.10
filelock==3.12.4
fire==0.5.0
Flask==3.0.0
flatbuffers==23.5.26
fonttools==4.42.1
frozenlist==1.4.0
fsspec==2023.9.0
gast==0.4.0
gevent==23.9.1
gitdb==4.0.10
GitPython==3.1.36
google-auth==2.23.0
google-pasta==0.2.0
google-re2==1.1
greenlet==3.0.0rc3
grpcio==1.58.0
h11==0.14.0
h2==4.1.0
h5py==3.9.0
hpack==4.0.0
httpcore==0.18.0
httpx==0.25.0
huggingface-hub==0.17.1
hypercorn==0.14.4
hyperframe==6.0.1
idna==2.10
imageio==2.31.3
ipython==8.16.1
itsdangerous==2.1.2
jedi==0.19.1
Jinja2==3.1.2
jmespath==1.0.1
joblib==1.3.2
keras==2.13.1
kiwisolver==1.4.5
lazy_loader==0.3
libclang==16.0.6
loguru==0.7.2
Markdown==3.4.4
MarkupSafe==2.1.3
matplotlib==3.8.0
matplotlib-inline==0.1.6
mpmath==1.3.0
multidict==6.0.4
networkx==3.1
ninja==1.11.1
nltk==3.8.1
numpy==1.24.3
oauthlib==3.2.2
opencv-python==4.8.0.76
opencv-python-headless==4.8.0.74
opt-einsum==3.3.0
outcome==1.2.0
packaging==23.1
pandas==2.1.0
parso==0.8.3
pickleshare==0.7.5
Pillow==9.5.0
playwright==1.37.0
priority==2.0.0
prompt-toolkit==3.0.39
protobuf==4.24.3
psutil==5.9.5
pure-eval==0.2.2
py-cord==2.4.1
py-cpuinfo==9.0.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pybboxes==0.1.6
pyclipper==1.3.0.post5
pycparser==2.21
pydantic==2.3.0
pydantic_core==2.6.3
pydub==0.25.1
pyee==9.0.4
Pygments==2.16.1
PyNaCl==1.5.0
pyparsing==2.4.7
PySocks==1.7.1
pystyle==2.9
python-bidi==0.4.2
python-dateutil==2.8.2
python-dotenv==1.0.0
pytube==15.0.0
pytz==2023.3.post1
PyWavelets==1.4.1
PyYAML==6.0.1
Quart==0.19.2
regex==2023.8.8
requests==2.31.0
requests-oauthlib==1.3.1
requests-toolbelt==1.0.0
rfc3986==1.5.0
rsa==4.9
safetensors==0.3.3
sahi==0.11.14
scikit-image==0.21.0
scikit-learn==1.3.0
scipy==1.11.2
scrapetube==2.5.1
selenium==4.12.0
sentencepiece==0.1.99
sgmllib3k==1.0.0
shapely==2.0.1
six==1.16.0
smmap==5.0.0
sniffio==1.3.0
sortedcontainers==2.4.0
soupsieve==2.5
SpeechRecognition==3.10.0
stack-data==0.6.3
starlette==0.27.0
sympy==1.12
tensorboard-data-server==0.7.1
tensorflow-estimator==2.13.0
tensorflow-io-gcs-filesystem==0.31.0
termcolor==2.3.0
terminaltables==3.1.10
terminut==0.0.0.931
threadpoolctl==3.2.0
tifffile==2023.8.30
tls-client==0.2.1
tokenizers==0.13.3
toml==0.10.2
torch==2.0.1
tqdm==4.66.1
traitlets==5.11.2
trio==0.22.2
trio-websocket==0.10.4
typing_extensions==4.7.1
tzdata==2023.3
urllib3==1.26.16
uvicorn==0.23.2
validators==0.20.0
veilcord==0.0.4.5
wavelink==2.6.4
wcwidth==0.2.8
webdriver-manager==4.0.0
websocket==0.2.1
websocket-client==1.6.3
websockets==11.0.3
Werkzeug==3.0.0
win32-setctime==1.1.0
wrapt==1.15.0
wsproto==1.2.0
yarl==1.8.2
zope.event==5.0
zope.interface==6.0

odd kiteBOT
#

@kind depot

Requirements-Check

โš ๏ธ Entferne alle Module aus der Python Standardbibliothek

DateTime==5.2```
โš ๏ธ Es sollte nur eine Discord Library installiert sein
```yml
discord==2.3.2
discord.py==2.3.2
py-cord==2.4.1```
*Ich habe [diese Nachricht](#1019974414487535736 message) geprรผft.*
fierce dove
#

Hast du irgendwo

await bot.add_cog()

vivid sky
urban glen
fierce dove
kind depot
#

ich habe es eigentlich schon deinstalliert...

vivid sky
#

sieht nicht danach aus

kind depot
fierce dove
kind depot
#

achsoo ne habe ohne await in den cogs

vivid sky
#

pip uninstall discord.py
pip uninstall discord
pip uninstall py-cord

pip install py-cord

Das in die console und Fertig

kind depot
#

oke...

#

habe ich

vivid sky
#

ja dann versuchen

kind depot
#

geht...

#

Danke

vivid sky
#

ja alles gut

kind depot
#

okee

vivid sky
#

ok

kind depot
#

Noch eine Frage... Wie macht man einen Bot wo man die Sprache auswรคhlen kann mit command?

twilit anvil
#

Also sogesehen alles Doppelt coden, bzw. รœbersetzen.

#

sehr vereinfachte version

kind depot
#

okee

#

und was macht man wenn noch keine sprache ausgewรคhlt ist`?

native plume
kind depot
#

okeee... hmm.. muss ich mal schauen ob ich das hinbekomme...

native plume
kind depot
#

wie meinst du?

twilit anvil
kind depot
#

okee

kind depot
#

wรคhre cool kenne mich noch nicht so aus..

kind depot
#

Noch eine Letzte Frage... Wie fragt man den Hyperquard einer Person ab?

#

weil bei mir kommt nur das...

fierce dove
#

Warum wird das Logo nicht richtig in den Kreis rein getan

#
import discord
from discord.ext import commands
from easy_pil import Editor, load_image_async, Font

class Welcome(commands.Cog):
    def __init__(self, bot):
        self.bot = bot
        
    @commands.Cog.listener()
    async def on_member_join(self, member):
        channel = self.bot.get_channel(1165736483257339917)
        
        pos = sum(m.joined_at < member.joined_at for m in member.guild.members if m.joined_at is not None)
        
        if pos == 1:
            te = "st"
        elif pos == 2:
            te = "nd"
        elif pos == 3:
            te = "rd"
        else: te = "th"
        
        background = Editor(f"wlcbg.jpg")
        profile_image = await load_image_async(str(member.display_avatar.url))
        
        profile = Editor(profile_image).resize((150, 150)).circle_image()
        
        poppins = Font.poppins(size=50, variant="bold")
        poppins_small = Font.poppins(size=20, variant="light")
        
        background.paste(profile, (350, 90))
        background.ellipse((400, 180), 150, 150, outline="gold", stroke_width=4, align="center")
        
        background.text((400, 260), f"WELCOME", color="white", font=poppins, align="center")
        background.text((400, 325), f"**{member.name}**", color="white", font=poppins_small, align="center")
        background.text((400, 360), f"Du bist der  {len(set(self.bot.users))} Member", color="#0BE7F5", font=poppins_small, align="center")
        
        file = discord.File(background.image_bytes, filename="wlcbg.jpg")
        
        await channel.send(file=file)
        

def setup(bot):
    bot.add_cog(Welcome(bot))
urban glen
#

Weil du es wahrscheinlich Falsch positionierst ._.

fierce dove
#

Nein

#

Habs

limber crow
#

Wie behebe ich diesen Fehler ?

Fehlercode

Task exception was never retrieved
future: <Task finished name='Task-1' coro=<MusikCommand.create_nodes() done, defined at c:\Users\YT197\Desktop\Allgemein\Dev\Discord\Pycord\Ninja Dojo (Public Bot)\cogs\Fun\musik.py:14> exception=AttributeError("type object 'NodePool' has no attribute 'create_node'")>
Traceback (most recent call last):
  File "c:\Users\YT197\Desktop\Allgemein\Dev\Discord\Pycord\Ninja Dojo (Public Bot)\cogs\Fun\musik.py", line 16, in create_nodes
    await wavelink.NodePool.create_node(bot=self.bot, host="127.0.0.1", port="2333", password="youshallnotpass", region="europe")
AttributeError: type object 'NodePool' has no attribute 'create_node'

Code

safe tendon
fierce dove
urban glen
normal sundial
#

hey kann mir wer helfen seit ich das neue video eingebaut habe in den code klappt meine user seite nicht mehr wo ein paar daten vom user beschrieben stehen.

@app.get("/user")
async def user(request: Request):
    session_id = request.cookies.get("session_id")
    if not session_id or not await db.get_session(session_id):
        raise HTTPException(status_code=401, detail="no auth")

    session = await db.get_session(session_id)
    token, refresh_token, token_expires_at, user_id = session

    user = await api.get_user(token)
    avatar = "https://cdn.discordapp.com/avatars/" + \
        user["id"] + "/" + user["avatar"]

    guild_count = await ipc.request("guild_count")

    return templates.TemplateResponse(
        "user.html",
        {
            "request": request,
            "user_avatar": avatar,
            "global_name": user["global_name"],
            "user_id": user["id"],
            "user.avatar": user["avatar"],
            "user_email": user["email"],
            "user": user,
            "premium": user["premium_type"],
            "count": guild_count.response
        }
    )
``` das ist der code der unverรคndert vorhin noch ging und seit der รคnderung habe ich den error:
#
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\applications.py", line 292, in __call__
    await super().__call__(scope, receive, send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 20, in __call__
    raise e
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\starlette\routing.py", line 66, in app
    response = await func(request)
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\routing.py", line 273, in app
    raw_response = await run_endpoint_function(
  File "C:\Users\Angel\AppData\Local\Programs\Python\Python310\lib\site-packages\fastapi\routing.py", line 190, in run_endpoint_function
    return await dependant.call(**values)
  File "c:\Users\Angel\Desktop\dashboard test - Kopie\main.py", line 186, in user
    token, refresh_token, token_expires_at, user_id = session
ValueError: not enough values to unpack (expected 4, got 3)

ich habe daran halt nichts verรคndert wo ist der fehler was รผbersehe ich ?

urban glen
#

Zeig mal deine get_session

normal sundial
#
async def get_session(self, session_id):
        return await self.one(
            "SELECT token, refresh_token, token_expires_at FROM sessions WHERE session_id = ?",
            session_id,
            detect_types=1
        )
#

habhs gefunden..๐Ÿคฆโ€โ™‚๏ธ

urban glen
urban glen
normal sundial
#

ja habs gefunden xD danke

raven lotus
#

Ist es mit Ezcord auch mรถglich einen anderen Prefix auรŸer / zu benutzen?

#

Weil bei mir kommt dauernd eine Fehlermeldung

odd kiteBOT
urban glen
urban glen
raven lotus
#

Also geht es?

urban glen
raven lotus
#

Wait

#

wie nenne ich dann ein neuen Command? Also @ezcord.command() ?

solid ingot
#

du kannst das genauso machen wie du es auch bei pycord machen wรผrdest

raven lotus
#

discord.command?

#

ist immer noch / ._.

restive herald
#

Slashcommand:
@slash_command()

Prefix:
@commands.command()

#

ohne den doppelpunkt upsi

raven lotus
#
discord.errors.ExtensionFailed: Extension 'cogs.moderation' raised an error: AttributeError: 'Bot' object has no attribute 'remove_command'
#

in main :
bot.load_cogs(subdirectories=True)

#

ist das falsch?

#
if __name__ == "__main__":
    bot.load_cogs
    bot.run('')
restive herald
#

zeig mal dienen moderation cog

raven lotus
#

was meinste dort?

#

alles?

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

def setup(bot):
    bot.add_cog(Moderation(bot))
#

also das ist die Klasse

twilit anvil
#

Moin! Wรผrde gerne einen Nutzer per Button Timeouten. Bekomme aber immer diesen Fehler:

#
Ignoring exception in view <ButtonView timeout=None children=1> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Timeout' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 421, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\Leander\GitHub Repo\tutorialbot\modules\moderation.py", line 50, in button_callback
    await self.user.timeout_for(until=datetime.now() + duration, reason=f"None")
                                      ^^^^^^^^^^^^
AttributeError: module 'datetime' has no attribute 'now'
#
import discord
from discord.ui.item import Item
import ezcord
import datetime

from discord.ext import commands
from discord.commands import SlashCommandGroup, Option, message_command

class ModSys(ezcord.Cog):
    moderation = SlashCommandGroup("moderation")

    @moderation.command(description="๐Ÿ“› | Lรถsche mehrere Nachrichten")
    async def purge(self, ctx, amount: Option(int, "๐Ÿ”ข|Die Anzahl der Nachrichten")):
        purged = await ctx.channel.purge(limit=amount)

        embed = discord.Embed(
            title=":sucess: `{}` Nachrichten gelรถscht".format(len(purged)),
            color=discord.Color.brand_green()
        )

        await ctx.respond(embed=embed, delete_after=5)


    @message_command(name="Nachricht melden")
    async def reportmsg(self, ctx, message):
        channel = self.bot.get_channel(1165367450343321656)
        embed = discord.Embed(
            title=":excl: Nachricht gemeldet",
            description=f"> Der Nutzer `{ctx.author}` hat eine Nachricht von `{message.author}` gemeldet!",
            color=discord.Color.brand_red()
        )
        embed.add_field(name="Nachricht", value=f"```{message.content}```", inline=False)

        await channel.send(embed=embed, view=ButtonView(self.bot, message.author))
        await ctx.respond("> Die Nachricht wurde an das Serverteam gemeldet.", ephemeral=True)

def setup(bot: discord.Bot):
    bot.add_cog(ModSys(bot))

class ButtonView(discord.ui.View):
    def __init__(self, bot, user):
        self.bot = bot
        self.user = user
        super().__init__(timeout=None)

    @discord.ui.button(label="Timeout", style=discord.ButtonStyle.danger)
    async def button_callback(self, button, interaction):
        duration = datetime.timedelta(days=5)

        await self.user.timeout_for(until=datetime.now() + duration, reason=f"None")

        await interaction.response.send_message("Hat geklappt!", ephemeral=True)
twilit anvil
#

Ich importiere das doch oben schon so?

vivid sky
#

Probier es doch

twilit anvil
#
Traceback (most recent call last):
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 421, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\Leander\GitHub Repo\tutorialbot\modules\moderation.py", line 49, in button_callback
    duration = datetime.timedelta(days=5)
               ^^^^^^^^^^^^^^^^^^
AttributeError: type object 'datetime.datetime' has no attribute 'timedelta'
raven lotus
#

datatime statt timedelta

#

glaube ich

twilit anvil
#
Traceback (most recent call last):
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 421, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\Leander\GitHub Repo\tutorialbot\modules\moderation.py", line 50, in button_callback
    duration = datetime.datetime(days=5)
               ^^^^^^^^^^^^^^^^^
AttributeError: type object 'datetime.datetime' has no attribute 'datetime'```
raven lotus
#

._.

#

Dann sry

#

Was passiert bei datetime(days=5) ?

twilit anvil
raven lotus
#

Achso

#

discord.errors.ExtensionFailed: Extension 'cogs.moderation' raised an error: AttributeError: 'Bot' object has no attribute 'remove_command'

twilit anvil
#

hรค

raven lotus
#

Bei mir

#

Ich kann irgendwie keine Prefix Commands machen ._.

twilit anvil
twilit anvil
raven lotus
#

Ich will beides machen

#

Broooo

twilit anvil
#

?

raven lotus
#
class Moderation(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

def setup(bot):
    bot.add_cog(Moderation(bot))
#

Ist die Class

twilit anvil
#

Hast du in der Main ezcord.Bot() zu ezcord.PrefixBot() gemacht?

raven lotus
#

In Main ja

twilit anvil
raven lotus
#

Also da steht:
ezcord.Bot(intens=intens, Prefix= "s!")

#

Dann ist das der Fehler wahrscheinlich ._.

twilit anvil
#

Nein.

#

ezcord.Bot(intens=intens, command_prefix= "s!")

#

Und intents nicht intens.

raven lotus
#

ja ik

#

war am handy ._.

twilit anvil
#

Aber wie gesagt: command_prefix nicht Prefix

restive herald
#

da muss was mit remove_command sein das

raven lotus
#

der Bot macht nix

#

bot = ezcord.PrefixBot(remove_command='s!')

#
bot = ezcord.Bot(intents=discord.Intents.all(), remove_command='s!')
bot = ezcord.PrefixBot(command_prefix='s!')
#

._.

raven lotus
#
    @commands.command(description="๐Ÿ”’ โ— Sperre einen Channel")
    @discord.default_permissions(manage_channels=True)
    @commands.has_permissions(manage_channels=True)
    async def lockchannel(self, ctx, channel: discord.TextChannel, role: discord.Role):
        await channel.set_permissions(ctx.author, send_messages=True)
        await channel.set_permissions(role, send_messages=False)
        await ctx.respond(f"Der Textkanal {channel.mention} wurde erfolgreich fรผr die Rolle {role.mention} gesperrt.")
raven lotus
twilit anvil
#

Warum zweimal Permissions?

solid ingot
native plume
raven lotus
native plume
raven lotus
#

Ah

#

Mit intents=intents?

kind depot
#

Habe eine frage... Undzwar... Es kommt ein Error und ich weis nicht warum...

CODE:

import discord
import ezcord
import aiosqlite
from discord.ext import commands
from discord.commands import SlashCommandGroup, Option


class Base(ezcord.Cog, name="Setup System", description="Start the setup from this server!", emoji="โš™๏ธ"):
    def __init__(self, bot: discord.Bot):
        self.bot = bot
        self.DB = 'bot-datenbank.db'

    async def check_guild(self, guild_id):
        async with aiosqlite.connect(self.DB) as db:
            await db.execute(
                "INSERT OR IGNORE INTO SetupLang (guild_id) VALUES (?)", (guild_id,)
            )
            await db.commit()

    setup = SlashCommandGroup("setup")

    @setup.command(description="โš™๏ธ ร— Setup the Lang of the Bot")
    @discord.guild_only()
    async def lang(self, ctx, lang: Option(str, choices=["de", "en"])):
        await self.check_guild(ctx.guild.id)
        async with aiosqlite.connect(self.DB) as db:
            if ctx.author.guild_permissions.administrator:
                async with db.execute("SELECT lang FROM SetupLang WHERE guild_id = ?", (ctx.guild.id)) as cursor:
                  lang = await cursor.fetchone()
                  if lang[0] == "de":
                      await db.execute(
                          "UPDATE SetupLang SET lang = ? WHERE guild_id = ?", ("de", ctx.guild.id)
                      )
                      await ctx.response("Sprache Gesetzt!")


def setup(bot: discord.Bot):
    bot.add_cog(Base(bot))

ERROR:

[ERROR] Error while executing /setup lang 
Traceback (most recent call last):
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\commands\core.py", line 978, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "e:\DATEIEN\PROGRAMIEREN\html\DASHBORD\cogs\setup.py", line 28, in lang
    async with db.execute("SELECT lang FROM SetupLang WHERE guild_id = ?", (ctx.guild.id)) as cursor:
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\aiosqlite\context.py", line 39, in __aenter__
    self._obj = await self._coro
                ^^^^^^^^^^^^^^^^
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\aiosqlite\core.py", line 190, in execute
    cursor = await self._execute(self._conn.execute, sql, parameters)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\aiosqlite\core.py", line 133, in _execute
    return await future
           ^^^^^^^^^^^^
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\aiosqlite\core.py", line 106, in run
    result = function()
             ^^^^^^^^^^
sqlite3.ProgrammingError: parameters are of unsupported type
kind depot
urban glen
#

Hast ein Komma vergessen

kind depot
#

ok

urban glen
#
async with db.execute("SELECT lang FROM SetupLang WHERE guild_id = ?", (ctx.guild.id)) as cursor:

zu

async with db.execute("SELECT lang FROM SetupLang WHERE guild_id = ?", (ctx.guild.id, )) as cursor:
raven lotus
#
discord.errors.ExtensionFailed: Extension 'cogs.moderation' raised an error: AttributeError: 'Bot' object has no attribute 'remove_command'
#
bot = ezcord.PrefixBot(intents=discord.Intents.all(), command_prefix='s!')
``` ist die lรถsung gewesen
#

jetzt muss ich alles nur noch in beides machen ._.

#

also / und s!

viscid lake
#

Glaube es geht nur eins oder gehen beide

raven lotus
#

Ich muss noch den Command verdoppeln

kind depot
#

habe gerade irgendwas in vscode gemacht und jz werden die dateien die ich รถffne einfach die ganze zeit nur noch einzelnt oben in der leiste angezeigt.... und dann muss man oben drรผber mit den pfeilen die datei weckseln... Kann mir wehr Helfen wie ich das wieder zurรผck bekomme?

kind depot
#

mann muss da oben bei den pfeilen umswitchen zwischen den dateien...

#

oder ehergesagt man kann nur eine datei offen haben..

graceful fiber
kind depot
graceful fiber
#

Oder enable preview wegselecten

graceful fiber
#

Einfach mal fix googeln...

kind depot
#

finde nix...

#

:c

quick osprey
#

Kann wer mir Helfen?

fierce dove
quick osprey
#

Bei meinen code

fierce dove
#

Schick Code

quick osprey
#
Modal einsatz
        modal = BotRequestModal()
        await interaction.response.send_message("Bot Request", ephemeral=True)
        await interaction.response.send_message(view=modal, ephemeral=True)

MODAL
class BotRequestModal(discord.ui.Modal):
    def __init__(self):
        super().__init__(timeout=None, title="Bot Request")

        self.add_item(
            discord.ui.InputText(
                label="What kind of bot do you need?",
                placeholder="Moderation bot, etc.",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="What functionalities do you want?",
                placeholder="Kick, ban, etc.",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="Your Discord username",
                placeholder="Example: jerom98",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="Preferred payment method",
                placeholder="Example: Paypal, Paysafe, or Amazon.",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="Do you intend to purchase the bot?",
                placeholder="Example: Yes or No",
                style=discord.InputTextStyle.long
            )
        )


Error
Ignoring exception in view <panel_buttons timeout=None children=2> for item <Button style=
  File "C:\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\utils\panel_buttons.py", line 59, in order_callback
    modal = BotRequestModal()
            ^^^^^^^^^^^^^^^^^
  File "c:\utils\panel_buttons.py", line 10, in __init__
    self.add_item(
TypeError: Modal.add_item() takes 2 positional arguments but 6 were given

solid ingot
#

du kannst pro self.add_item nur einen inputtext hinzufรผgen

quick osprey
solid ingot
#

ja genau, entweder das, oder du rufst mehrmals self.add_item auf

quick osprey
#

Jetzt habe ich noch einen Fehler, denn ich nicht alleine beheben kann.

Ignoring exception in view <panel_buttons timeout=None children=2> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='๐Ÿ’น Order Bot' emoji=None row=None>:
Traceback (most recent call last):
  File "C:appData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\utils\panel_buttons.py", line 56, in order_callback
    modal = BotRequestModal()
            ^^^^^^^^^^^^^^^^^
  File "c:\utils\panel_buttons.py", line 8, in __init__
    super().__init__(
TypeError: Modal.__init__() missing 1 required keyword-only argument: 'title'
solid ingot
#

schick Mal deine aktuellen code

ruby sparrow
#

@solid ingot timo kannst du kurz kommen ?

quick osprey
solid ingot
#

ne hier

fierce dove
#

Dm ist verboten

quick osprey
quick osprey
quick osprey
fierce dove
quick osprey
#

?????

fierce dove
#

Code + error

solid ingot
#

in der super().__init__ methode mรผsstest du noch einen titel fรผr das modal angeben. ein beispiel findest du im modal tutorial code

odd kiteBOT
solid ingot
#

ah warte im tutorial ist es mit kwargs gemacht worden, aber statt **kwargs kannst du schreiben title="Keks"

quick osprey
# solid ingot ah warte im tutorial ist es mit kwargs gemacht worden, aber statt `**kwargs` kan...

Habe da noch ein Fehler, ich denke ich mache irgendwas falsch
Code:

class BotRequestModal(discord.ui.Modal):
    def __init__(self, *args, **kwargs):
        super().__init__(
            discord.ui.InputText(
                label="What kind of bot do you need?",
                placeholder="Moderation bot, etc.",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="What functionalities do you want?",
                placeholder="Kick, ban, etc.",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="Your Discord username",
                placeholder="Example: jerom98",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="Preferred payment method",
                placeholder="Example: Paypal, Paysafe, or Amazon.",
                style=discord.InputTextStyle.long
            ),
            discord.ui.InputText(
                label="Do you intend to purchase the bot?",
                placeholder="Example: Yes or No",
                style=discord.InputTextStyle.long
            ),
            *args,
            **kwargs,
            title="Bot Request"
            )


Error:

    await interaction.response.send_message(view=modal, ephemeral=True)
    raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.1.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.2.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.3.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
In data.components.4.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
#

Okay ich habs danke

dreamy bobcat
#

ich habe ein kleines problem und zwar mein bot der in python geschrieben ist und pycord nutzt, lรคdt nicht mehr commands als 44

#

woran kann das liegen?

solid ingot
#

das kann sehr viele ursachen haben: cogs werden nicht geladen, falsche einrรผckung, ...

dreamy bobcat
#

da stimmt ja alles

#

darf ich dir mal die datei senden die ich gerade erstellt habe?

solid ingot
solid ingot
dreamy bobcat
#

vielleicht siehst du ja einen fehler, den ich uns vsc nicht sehen

solid ingot
#

woran siehst du denn, dass die commands nicht geladen wurden?

dreamy bobcat
#

da dran

#

es war davor auch schon auf 44 der cog wird zwar erkannt aber die commands offensichtlich nicht

#

und im server sind diese auch nicht zu sehen

#

das problme habe ich schon seit gestern

#

ich wollte einen command in die main.py packen der da auch rein muss, ging alles nicht

dreamy bobcat
#

was mache ich jetzt gegen dieses problem?

solid ingot
#

gute frage, du kรถnntest stรผck fรผr stรผck herausfinden, woran es liegt. also zum beispiel einen der commands in ein anderes cog tun, um zu schauen, ob es an der cog datei liegt, printen lassen ob das cog geladen wird, etc

dreamy bobcat
#

wie lasse ich das printen?

solid ingot
#

zB in der mit Methode vom cog oder Im on ready event

tawdry leaf
#

Ist doch klar das es an der einen liegt die er hinzugefรผgt hat ๐Ÿ˜‚

edgy axle
#
import discord
from discord.ext import commands
from discord.ext.pages import Paginator, Page
from discord.commands import Option, slash_command

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

    @slash_command(description="Itemshop zum kaufen /buy (Item)")
    async def shop(self, ctx):
        pages = [
            Page(embed_a=discord.Embed(title="Animals ๐Ÿฆ–", description="- Chicken 500 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:", colour=discord.Colour(0x7ed321))),
            Page(embed_b=discord.Embed(title="Roles ๐Ÿ“œ", description="- Pusher 100.000 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:", colour=discord.Colour(0x4a4a4a))),
            Page(embed_c=discord.Embed(title="Other ๐Ÿ”ฎ", description="Hier gibt es noch nichts zu sehen", colour=discord.Colour(0x52507c)))
        ]
        
        paginator = Paginator(pages=pages)
        
        await paginator.respond(ctx.interaction)

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

Ich versteh nicht ganz was ich hier falsch mache, wenn ich /shop ausfรผhre bekomme ich keine Rรผckmeldung vom bot, ich hab schon alles mรถgliche versucht listen รคndern usw..

Fรคllt da jemandem was auf woran es liegen kรถnnte?

native plume
edgy axle
edgy axle
#

Ja

urban glen
#

fรผg einfach mal ein await ctx.respond hinzu

#

und schau mal ob es mit einem ctx.respond geht geht

edgy axle
raven lotus
#

Ich habe eine wichtige Frage:
Ich nutze Pycharm und habe vergessen den Code zu stoppen und habe statt terminate discordnect gemacht. Wird der Bot nach ner Zeit Off gehen oder bleibt der online?

urban glen
#

der bleibt online bis du ihn im Taskmanager stoppst soweit ich weiรŸ

raven lotus
#

Der PC ist jetzt aus und der Bot ist off

#

Geht wieder

#

Kurze Frage:
Muss ich, damit ein Command nur auf einer guild ist, dann das so machen oder anders? :

@slash_command(guild=Id)
edgy axle
# urban glen und schau mal ob es mit einem ctx.respond geht geht
import discord
from discord.ext import commands
from discord.ext.pages import Paginator, Page
from discord.commands import Option, slash_command

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

    @slash_command(description="Itemshop zum kaufen /buy (Item)")
    async def shop(self, ctx):
        await ctx.respond("vor embed") # wird ausgefรผhrt
        embed_a = discord.Embed(title="Animals ๐Ÿฆ–", description="- Chicken 500 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:", colour=discord.Colour(0x7ed321))
        embed_b = discord.Embed(title="Roles ๐Ÿ“œ", description="- Pusher 100.000 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:\n- Empty 000 :coin:", colour=discord.Colour(0x4a4a4a))
        embed_c = discord.Embed(title="Other ๐Ÿ”ฎ", description="Hier gibt es noch nichts zu sehen", colour=discord.Colour(0x52507c))
        await ctx.respond(embed = embed_a) # wird ausgefรผhrt

        pages = [Page(embed=embed_a)] #, Page(embed=embed_b), Page(embed=embed_c)]
        paginator = Paginator(pages=pages)
        
        await paginator.respond(ctx.interaction)

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

Ich habs mal etwas anders gemacht und so klappt das auch nicht, ich hab echt keine Idee mehr woran das liegen kรถnnte xD

native plume
raven lotus
#

Ah, ok

#

Danke

native plume
native plume
upper adder
#

Hallรถle!

Man konnte doch mal mit attachments://irgendwas einen Anhang im Browser รถffnen, wie ging der Link nochmal?

twilit anvil
upper adder
#

jup, danke ๐Ÿ‘Œ๐Ÿป

#

รคh, ne. Nicht ganz ๐Ÿ˜…

#

Will einen Anhang (html) im Browser รถffnen.

ruby sparrow
#

@upper adder zb das ?

upper adder
#

jup

#

Muss ich da ne Website aufsetzen fรผr?

ruby sparrow
#

ne

odd kiteBOT
#

Mein Discord Server
โ–บ https://discord.gg/zfvbjTEzv6

Links aus diesem Video
Chat Exporter โ–บ https://github.com/mahtoid/DiscordChatExporterPy

โ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌ
Mein Hosting* โ–บ https://tidd.ly/3gJufg6
Code auf Github โ–บ https://github.com/tibue99/tutorial-bot

PYCORD
Docs โ–บ https://docs.pycord.dev/
Guide โ–บ https://guide.pycord.dev/introductio...

โ–ถ Play video
ruby sparrow
#

@upper adder

upper adder
#

I know

#

Das mit dem Link. Will aber nicht den sein Link ๐Ÿ˜…

upper adder
#

wait a moment

#

ach man, ja, das mein Ich.

ruby sparrow
#

das wurt auch gezeig

upper adder
#

dann war ich blind

#

i mean, ohne die File extra runterladen zu mรผssen. Einfach Link, und bumm.

ruby sparrow
limber crow
upper adder
#

JA. Aber ich will die math.io oder so Seite nicht.

upper adder
ruby sparrow
limpid wolf
upper adder
#

Es gibt nen Framework oder irgendwas, was Discord mow imitieren kann. Kann dir gerne mal den Link einer Bot-Website schicken, wo du das sehen kannst.
Des Ding is, ich glaube dafรผr brauchste HTML, CSS UND JS...

fringe hedge
#

hi leude, habe eine frage uns war wie kann ich emojis von discord auf meinem bot รผbertragen z.b habe ich ein emoji names (arrow -> :arrow : ), und will es bei meinem bot nutzen kรถnnen wie mache ich das muss ich die id kopieren oder so?

solid ingot
#

ja du kannst die ID als string in deinem code nutzen

fringe hedge
solid ingot
#

der bot muss auf dem server sein, der das emoji hat

fringe hedge
solid ingot
#

naja, diese bots sind dann auch auf dem server, der diese custom emojis hat

limber crow
#

Hat wer nen gutes Video fรผr MySQL und Python fรผr Discord Bots?

opaque blade
#

Heyoo, kann mir wer vllt helfen mit requirements.txt? Ich habe ein paar packages installiert die aber nicht verwendet werden. Dazu will ich keine verisons nummer haben da es ja die aktuellste sein sol

opaque blade
#

geht gerade schlecht

#

gucke gerade mit friends neben bei cyberpunk: edgerunners

limber crow
opaque blade
#

weil er sagt alles was ich installiert habe, was aber fuer den bot useless ist

limber crow
opaque blade
opaque blade
#
Traceback (most recent call last):
  File "/home/container/main.py", line 1, in <module>
    import discord
ModuleNotFoundError: No module named 'discord'
container@pterodactyl~ Server marked as offline...
[Pterodactyl Daemon]: ---------- Detected server process in a crashed state! ----------
[Pterodactyl Daemon]: Exit code: 1
[Pterodactyl Daemon]: Out of memory: true
[Pterodactyl Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
#

kann mir wer sagen was ich jetzt machen soll? hab gerade nur probleme mit requirements.txt > error in der console

tawdry leaf
opaque blade
tawdry leaf
opaque blade
# tawdry leaf Zeig mal deine requirements.txt
aiocache==0.12.2
aiohttp==3.8.6
aiosignal==1.3.1
aiosqlite==0.19.0
asgiref==3.7.2
async-timeout==4.0.3
attrs==23.1.0
certifi==2023.7.22
cffi==1.16.0
charset-normalizer==3.3.1
colorama==0.4.6
discord==2.3.2
discord.py==2.3.2
Django==4.2.6
docopt==0.6.2
easy-pil==0.3.0
ezcord==0.3.7
ffmpeg-python==0.2.0
frozenlist==1.4.0
future==0.18.3
idna==3.4
imageio-ffmpeg==0.4.9
multidict==6.0.4
numpy==1.26.1
Pillow==9.5.0
pipreqs==0.4.13
py-cord @ git+https:github.com/Pycord-Development/pycord@927f8cefb0a5ba8ed5f2c7ccad3f734852bef62e
pycord==0.1.1
pycparser==2.21
PyNaCl==1.5.0
python-dotenv==1.0.0
pytz==2023.3.post1
requests==2.31.0
sqlparse==0.4.4
typing_extensions==4.8.0
tzdata==2023.3
urllib3==2.0.7
yarg==0.1.9
yarl==1.9.2
youtube-dl==2021.12.17
#

hab das sehr viel scheisse drin und vieles brauch ich auch einfach nicht aber es ist trotzdem da lol

opaque blade
#

irgendwie beides

#

ich hab den ueberblick verloren ist das problem

#

okay habs raus

ruby sparrow
#

@opaque blade #๐Ÿ”ใƒปpycord-help

native plume
odd kiteBOT
#

@opaque blade

Requirements-Check

โš ๏ธ Es sollte nur eine Discord Library installiert sein

discord==2.3.2
discord.py==2.3.2
py-cord @ git+https:github.com/Pycord-Development/pycord@927f8cefb0a5ba8ed5f2c7ccad3f734852bef62e```
โš ๏ธ Eventuell hast du falsche Packages installiert
```yml

pycord==0.1.1 -> py-cord```
*Ich habe [diese Nachricht](#1019974414487535736 message) geprรผft.*
twilit anvil
#
Application Command raised an exception: AttributeError: 'int' object has no attribute 'id'
[ERROR] Error while executing /automod custom 
Traceback (most recent call last):
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 131, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 1000, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Leander\PycharmProjects\cyberguard\modules\automod.py", line 72, in custom
    await ctx.guild.create_auto_moderation_rule(
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\guild.py", line 3810, in create_auto_moderation_rule
    payload["exempt_roles"] = [r.id for r in exempt_roles]
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\guild.py", line 3810, in <listcomp>
    payload["exempt_roles"] = [r.id for r in exempt_roles]
                               ^^^^
AttributeError: 'int' object has no attribute 'id'
#

Kann mir da wer helfen?

#

Der Zweite Command ist gemeint: Damit soll man eine Custom AutomodRegel erstellen.

solid ingot
#

r scheint bereits ein integer zu sein, deswegen kannst du nicht .id damit machen

twilit anvil
# solid ingot r scheint bereits ein integer zu sein, deswegen kannst du nicht .id damit machen

Jetzt kommt der Fehler: ```py
[ERROR] Error while executing /automod custom
Traceback (most recent call last):
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 131, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 1000, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "C:\Users\Leander\PycharmProjects\cyberguard\modules\automod.py", line 72, in custom
await ctx.guild.create_auto_moderation_rule(
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\guild.py", line 3813, in create_auto_moderation_rule
payload["exempt_channels"] = [c.id for c in exempt_channels]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'TextChannel' object is not iterable

solid ingot
#

ah warte das ist ja nicht dein Code mit dem r.id, ich komm gleich am pc online schick bis dahin Mal deinen Code

solid ingot
#

du versuchst bei den ignorierten rollen einen textchannel reinzutun?

#

da mรผss ne rolle rein oder

twilit anvil
#
exempt_channels=ignored_channels,
exempt_roles=[ignored_roles]```
solid ingot
#

stimmt

#

wieso ist ignored_channels keine liste?

twilit anvil
#

Muss sie?

solid ingot
#

ja

twilit anvil
#

lul

#

@solid ingot ```py
Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In trigger_metadata.keyword_filter: Only iterables may be used in a ListType
[ERROR] Error while executing /automod custom
Traceback (most recent call last):
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 131, in wrapped
ret = await coro(arg)
^^^^^^^^^^^^^^^
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 1000, in _invoke
await self.callback(self.cog, ctx, **kwargs)
File "C:\Users\Leander\PycharmProjects\cyberguard\modules\automod.py", line 72, in custom
await ctx.guild.create_auto_moderation_rule(
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\guild.py", line 3815, in create_auto_moderation_rule
data = await self._state.http.create_auto_moderation_rule(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leander\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\http.py", line 371, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In trigger_metadata.keyword_filter: Only iterables may be used in a ListType

limber crow
#

@solid ingot wie kann ich in einem Help eines deiner Videos mit dem Bot reinschicken, damit nen User weiรŸ um welches Video es geht

solid ingot
#

/codingkeks

#

also generell alles fรผr help hat der @odd kite bot

odd kiteBOT
#

Mein Discord Server
โ–บ https://discord.gg/zfvbjTEzv6

Links aus diesem Video
Contabo Hosting* โ–บ https://tidd.ly/3gJufg6
Termius โ–บ https://termius.com/download/windows
MobaXterm โ–บ https://mobaxterm.mobatek.net/download.html

โ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌ
Commands aus dem Video

adduser tutorial
usermod -aG sudo tutorial

sudo apt update
sudo apt upgrade
...

โ–ถ Play video
limber crow
stone flint
#

hoste nicht auf einem linux serverโ€ฆ

limber crow
lofty rock
#

Ich kriege irgendwie immer erros wenn ich eine py lib runterladen mรถchte (pip install) kann mir jemand sagen welche Python Version ich nutzen soll

urban glen
lofty rock
#

Seitdem ich windows 11 hab

jaunty jasper
#

WeiรŸ jmd wie das Event heiรŸt, welches bei einem Server Boost getriggert wird?

jaunty jasper
#

Also ich dachte schon... mhm

ruby sparrow
#
[ERROR] Error while executing /embed 
Traceback (most recent call last):
  File "C:\Users\nicor\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 131, in wrapped
    ret = await coro(arg)
  File "C:\Users\nicor\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\commands\core.py", line 1000, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\nicor\OneDrive\Desktop\Blitz Bot\mods\Embed.py", line 13, in embed
    modal = EmbedModal()
  File "C:\Users\nicor\OneDrive\Desktop\Blitz Bot\mods\Embed.py", line 18, in __init__
    super().__init__(discord.ui.InputText(
TypeError: Modal.__init__() missing 1 required keyword-only argument: 'title'```
#
class EmbedModal(discord.ui.Modal):
    def __init__(self):
        super().__init__(discord.ui.InputText(
            label="Embed Titel",
            placeholder="Schreibe hier!"
        ),
        discord.ui.InputText(
            label="Embed Beschreibung",
            placeholder="Schreibe hier!",
            style=discord.InputTextStyle.long
        )
    )
urban glen
ruby sparrow
#

ja hab schon

jaunty jasper
#

Console:

**True**

Ignoring exception in command testing:
Traceback (most recent call last):
  File "C:\Users\fabian2\venv\Lib\site-packages\discord\commands\core.py", line 124, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\fabian2\venv\Lib\site-packages\discord\commands\core.py", line 982, in _invoke
    await self.callback(ctx, **kwargs)
  File "C:\Users\fabian2\PycharmProjects\devla\main.py", line 48, in owner_testing
    await ctx.guild.edit(owner=user)
  File "C:\Users\fabian2\venv\Lib\site-packages\discord\guild.py", line 1853, in edit
    raise InvalidArgument(
discord.errors.InvalidArgument: To transfer ownership you must be the owner of the guild.

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

Traceback (most recent call last):
  File "C:\Users\fabian2\venv\Lib\site-packages\discord\bot.py", line 1114, in invoke_application_command
    await ctx.command.invoke(ctx)
  File "C:\Users\fabian2\venv\Lib\site-packages\discord\commands\core.py", line 375, in invoke
    await injected(ctx)
  File "C:\Users\fabian2\venv\Lib\site-packages\discord\commands\core.py", line 132, in wrapped
    raise ApplicationCommandInvokeError(exc) from exc
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: InvalidArgument: To transfer ownership you must be the owner of the guild.

Code:

@bot.slash_command(name='testing')
async def owner_testing(ctx, user: discord.Member):
    print(ctx.user.id == ctx.guild.owner.id)
    await ctx.guild.edit(owner=user)
urban glen
#

Das geht nicht

#

Weil bei ctx.guild.edit macht der bot das

jaunty jasper
#

Warum steht es dann im Wiki

urban glen
#

weil der bot will es ja changen

jaunty jasper
urban glen
#

positiv

jaunty jasper
#

:O

ruby sparrow
#
if ctx.author == ctx.guild.owner:
        try:
            await ctx.guild.edit(owner=user)
            await ctx.send(f"Die Servereigentรผmerschaft wurde an {user.mention} รผbertragen.")
        except discord.errors.Forbidden:
            await ctx.respond("Ich habe keine Berechtigung, die Eigentรผmerschaft zu รผbertragen.")
    else:
        await ctx.respond("Du musst der Besitzer des Servers sein, um die Eigentรผmerschaft zu รผbertragen.")``` @jaunty jasper du kannst zb so machen
urban glen
#

Also wenn der Bot dann der Owner vom Server ist

jaunty jasper
#

Danke

urban glen
#

du machst ein else wenn da kein if ist

ruby sparrow
urban glen
#

gumo wie macht man slash commands in discord.py? irgendwie macht es jedes tutorial anders was mich ein wenig verwirrt. gibt es den einen gรคngigen oder "richtigen" weg dafรผr?

#

danke

ruby sparrow
#

bitte

urban glen
#

nein

#

@urban glen in main datei oder cog?

#

wie dann

#

es gibt 100 mรถglichkeiten

urban glen
#

also nein

urban glen
#

ja

ruby sparrow
#

komm mal kurz call

#

mini

urban glen
#

in coding?

#

ja warte schnell

ruby sparrow
#

ja

#

@urban glen kannst du noch mal kommen ?

urban glen
#

ok

#

@urban glen

@bot.tree.command(name="test")
async def _test(ctx: discord.Interaction):
    await ctx.response.send_message("Test")
#

da muss ich doch syncen right

urban glen
#

ok

#
@bot.event
async def on_ready():
    try:
        synced = await bot.tree.sync()
        for command in synced:
            print(f"Synced Command: {command}")
    except Exception:
        print(traceback.format_exc())
#

@urban glen

#

jo

#

ich guck mal obs geht lol

#

Aber das problem ist, man bekommt keine errors wenns nh fehler in nem slash command gibt.

Fรผg das hinzu:

import traceback

async def on_tree_error(ctx: discord.Interaction, error: app_commands.AppCommandError):
    traceback.print_exc()
    print(error)


bot.tree.on_error = on_tree_error


@bot.tree.error
async def on_app_command_error(error: app_commands.AppCommandError, interaction: discord.Interaction):
    traceback.print_exc()
    print(error)
#

danke

ruby sparrow
urban glen
#

@ruby sparrow brauch hilfe uwu

ruby sparrow
raven lotus
#

weiรŸ jemand wie ein Bot auf eine Nachricht antwortet?

#
@bot.event
async def on_message(message):
    if bot.user.mentioned_in(message):
        response = await message.channel.send("Mein Prefix ist `s!`")
    await asyncio.sleep(5)
    await response.delete()
    await bot.process_commands(message)
urban glen
raven lotus
#

AAAAAh

#

thx

#

geht jetzt ๐Ÿ‘

@bot.event
async def on_message(message):
    if bot.user.mentioned_in(message):
        await message.reply("Mein Prefix ist `s!`")
    await asyncio.sleep(5)
    await message.delete()
    await bot.process_commands(message)
#

es kommt dauernd, wenn ich den Bot starte dieser Error:

[ERROR] Error in event on_connect 
Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\bot.py", line 1164, in on_connect
    await self.sync_commands()
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\bot.py", line 738, in sync_commands
    app_cmds = await self.register_commands(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\bot.py", line 531, in register_commands
    prefetched_commands = await self._bot.http.get_guild_commands(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\http.py", line 365, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
#

ich weiรŸ auch nicht wie ich das behebe

#

es hat aber nix eig mit dem Error zu tun

ruby sparrow
#

warte

urban glen
raven lotus
#

habs aber so gemacht

urban glen
#

Vielleicht is eine ID Falsch

raven lotus
#

ne

urban glen
#

Weil der Bot kann wohl nicht auf einen Server den du angegeben hast zugreifen

raven lotus
#

es geht

urban glen
#

geht es jetzt?

ruby sparrow
ruby sparrow
raven lotus
#
debug_guilds=1145321602104447016, 1091692144802152478
    @commands.command(guild_ids=debug_guilds)
#

so sieht es etwa aus

urban glen
#

debug_guilds=[1145321602104447016, 1091692144802152478]

odd kiteBOT
raven lotus
#

hab ich gemacht

#

kommt trotzdem error

#

jetzt gehts?

#

warum geht's plรถtzlich?

#

Hรครครครครครครครครครครครครครครครครค

#

ich habe 4 mal restartet

#

ne doch net

#
[ERROR] Error in event on_connect 
Traceback (most recent call last):
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\bot.py", line 1164, in on_connect
    await self.sync_commands()
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\bot.py", line 738, in sync_commands
    app_cmds = await self.register_commands(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\bot.py", line 531, in register_commands
    prefetched_commands = await self._bot.http.get_guild_commands(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\PycharmProjects\spideybot\venv\Lib\site-packages\discord\http.py", line 365, in request
    raise Forbidden(response, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
limpid wolf
opaque blade
#

Moinooo, ich bekomme beim starten meines Bot diesen Error. Ich benutze Py-cord. Wenn ich aber das 'command_prefix' adde wie er es will, werden meine slash commands nicht mehr benutzt. das sieht man im bild.

Traceback (most recent call last):
  File "c:\Users\Kai\Desktop\BullenscheiรŸe\discordserver\Bots\Spongebob_Bot\main.py", line 15, in <module>
    bot = ezcord.Bot(
  File "C:\Users\Kai\AppData\Local\Programs\Python\Python310\lib\site-packages\ezcord\bot.py", line 88, in __init__
    super().__init__(intents=intents, **kwargs)
TypeError: BotBase.__init__() missing 1 required positional argument: 'command_prefix'
limber crow
opaque blade
#

benutze auch ezcord

limber crow
opaque blade
#

Und wie genau?

limber crow
#

Steht in den Docs

opaque blade
#

hm zeigt mir aber leider immernoch den gleichen error an

limber crow
opaque blade
limber crow
opaque blade
raven lotus
# restive herald Schick ma die main.py
import discord
from discord import Embed, Color
from discord.ext import commands, tasks
from discord.commands import slash_command, Option
import ezcord
import aiosqlite
import datetime
import os
import sys
import asyncio

bot = ezcord.PrefixBot(intents=discord.Intents.all(), command_prefix='s!')

@bot.event
async def on_ready():
    print(f'Logged in as {bot.user.name}')
    activity = discord.Game("Prefix: s! โ€ข Bot in Arbeit!")
    await bot.change_presence(activity=activity)

@bot.event
async def on_member_join(member):
    role_ids = [1150776482994593803, 1154906938467962982]
    for role_id in role_ids:
        role = member.guild.get_role(role_id)
        await member.add_roles(role)

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return
    if bot.user.mentioned_in(message):
        await message.reply("Mein Prefix ist `s!`")
        await asyncio.sleep(5)
        await message.delete()
    await bot.process_commands(message)

@tasks.loop(minutes=5)  # Aktualisierung alle 5 Minuten
async def update_channels():
    guild_id =   # ID des Servers
    member_channel_id =   # ID des Sprachkanals fรผr alle Mitglieder
    user_channel_id =   # ID des Sprachkanals fรผr Benutzer
    bot_channel_id =   # ID des Sprachkanals fรผr Bots
    boost_channel_id =   # ID des Sprachkanals fรผr Boosts

    guild = bot.get_guild(guild_id)
    member_channel = guild.get_channel(member_channel_id)
    user_channel = guild.get_channel(user_channel_id)
    bot_channel = guild.get_channel(bot_channel_id)
    boost_channel = guild.get_channel(boost_channel_id)

    if member_channel:
        members = len(guild.members)  # Anzahl der Mitglieder im Server
        await member_channel.edit(name=f"๐Ÿ’Ž | Member: {members}")

    if user_channel:
        users = sum(not member.bot for member in guild.members)  # Anzahl der Benutzer im Server
        await user_channel.edit(name=f"๐Ÿ‘ฅ | User: {users}")

    if bot_channel:
        bots = sum(member.bot for member in guild.members)  # Anzahl der Bots im Server
        await bot_channel.edit(name=f"๐Ÿค– | Bots: {bots}")

    if boost_channel:
        boosts = guild.premium_subscription_count  # Anzahl der Boosts im Server
        await boost_channel.edit(name=f"๐Ÿš€ | Boosts: {boosts}")


@update_channels.before_loop
async def before_update_channels():
    await bot.wait_until_ready()

update_channels.start()

bot.load_cogs(subdirectories=True)

if __name__ == "__main__":
    bot.load_cogs
    bot.run('Token')
ruby sparrow
kind depot
#

@solid ingot

bot.add_status_changer(
    [
        "โœจ ร— BฮžTฮ›",
        "๐Ÿ‘ฅ ร— {user_count} Users",
        discord.Game("๐Ÿ“ˆ ร— {guild_count} Servers"),
    ]
)
PS E:\DATEIEN\PROGRAMIEREN\html\DASHBORD\Coin-Bot> & C:/Users/minec/AppData/Local/Microsoft/WindowsApps/python3.11.exe e:/DATEIEN/PROGRAMIEREN/html/DASHBORD/Coin-Bot/bot.py
Traceback (most recent call last):
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\cog.py", line 777, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ezcord\cogs\status_changer.py", line 9, in <module>
    class Activity(Cog, hidden=True):
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ezcord\cogs\status_changer.py", line 29, in Activity
    @discord.ext.tasks.loop()
     ^^^^^^^^^^^^^^^^^
AttributeError: module 'discord.ext' has no attribute 'tasks'

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

Traceback (most recent call last):
  File "e:\DATEIEN\PROGRAMIEREN\html\DASHBORD\Coin-Bot\bot.py", line 14, in <module>
    bot.add_status_changer(
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\ezcord\bot.py", line 579, in add_status_changer
    self.load_extension(f".cogs.status_changer", package="ezcord")
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\cog.py", line 913, in load_extension   
    self._load_from_module_spec(spec, name)
  File "C:\Users\minec\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\discord\cog.py", line 780, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'ezcord.cogs.status_changer' raised an error: AttributeError: module 'discord.ext' has no attribute 'tasks'
ruby sparrow
#
from discord.ext import tasks```
#

@kind depot

restive herald
urban glen
kind depot
#

jz geht es...

dreamy bobcat
#

kleine frage, wie macht man es, dass man slash und prefix commands hat? oder wie macht man รผnerhaubt prefix commands?

ruby sparrow
#

machst du mit ezcord oder nur py-cord?

dreamy bobcat
#

natรผrlich beides

ruby sparrow
dreamy bobcat
#

und wie mache ich beides in einem bot?

#

also slash und prefix im selben bot. ?

dreamy bobcat
#

ezcord.bot.BridgeBot geht auch oder?

#

und was muss man jetzt in einem cog machen?

urban glen
odd kiteBOT
urban glen
#

Scheint wohl, ja

urban glen
dreamy bobcat
#

danke fรผr die hilfe

#

wie macht man das mit commands.cog.listener ?

solid ingot
#

unterscheide aber: wenn du denselben command als prefix und slash command haben willst, brauchst du den bridge bot. wenn du aber ein paar commands als slash commands haben willst, und andere commands als prefix commands haben willst, kannst du den ganz normalen prefixbot verwenden

dreamy bobcat
#

achso. ich wollte es so machen das alle commands beides haben und manche dann die nur fรผr die entwickler sind, die sollen dann prfix sein

ruby sparrow
#

zb so

dreamy bobcat
#

achso das bleibt so, hรคtte gedacht da รคndert sich auch etwas am @

dreamy bobcat
#

was ist da jetzt das problem ?

     ^^^^^^
NameError: name 'bridge' is not defined
dreamy bobcat
#

ja weiรŸ ich jetzt auch

#

die beiden commands die da enthalten sind, die funktionieren seltsamerweise nicht. die habe ich schon seit einiger zeit und die haben noch nie funktioniert. weiรŸ wer vin euch, was da falsch ist?

raven lotus
restive herald
raven lotus
#

Immer wenn ich starte

#

Und ich habe Administrator als Permision eingestellt

#

Also wenn man ihn autorisiert

restive herald
#

schick mal screen von deiner ide beim starten

raven lotus
#

Wie meinste?

#

Also an sich geht alles

#

Es kommt halt dauernd der error

raven lotus
#

Soll ich debug_guilds umbenennen???

#

Kann das das Problem sein vllt?

restive herald
raven lotus
#

Hab ich auch

#

Ist alte Nachricht

#

Soll ich debug_guilds vielleicht umbenennen? Kann das sein, dass deswegen der Error kommt?

ruby sparrow
#

@raven lotus bei mir kommt kein error hab dein code getest

raven lotus
#

Komisch

#

Ja, idk warum das bei mir kommt

#

Vllt probiere ich es mal auf einem Server und nicht auf meinem Pc

ruby sparrow
raven lotus
#

Ich teste es mal an einem Server vllt

urban glen
raven lotus
#

6 commands

urban glen
raven lotus
#

Also 3 in jeder Datei

#

Wait

#

Was ist der Unterschied zwischen Pycharm Community und Pycharm Professional?

ruby sparrow
raven lotus
#

Ich benutze Pycharm Community

quick osprey
raven lotus
#

Ist glaube ich auch unkomplizierter

ruby sparrow
#

es reicht auch aus

#

geht jerzt ?

limber crow
raven lotus
#

Wie kann man, wie bei Vencord, eine Custom Activity machen?

opaque blade
raven lotus
# urban glen

Man hat Zugriff auf SQLite, also man sieht alles von der Datenbank?

raven lotus
#

._.

#

Hab was auf YT gefunden

#

Also ich meinte Rpc

urban glen
urban glen
#

Hat nix mit Vencord zutun

#

er meinte selber coden

opaque blade
# ruby sparrow send main.py
import discord
import os
import ezcord
import pytz
from discord.ext import commands
from discord import Embed
from dotenv import load_dotenv
from datetime import datetime



intents = discord.Intents.all()
activity = discord.Activity(type=discord.ActivityType.watching, name=" /help auf Nick :purple_heart:")
status = discord.Status.online

bot = ezcord.bot(
    intents=intents,
    activity=activity,
    status=status,
    language="de")

bot.add_help_command
de = pytz.timezone('Europe/Berlin')



# --- JOIN WELCOME MESSAGE
@bot.event
async def on_member_join(member):
    guild = bot.get_guild(1042477080186720296)
    embed = discord.Embed(
        title="Ein wildes etwas ist aufgetaucht!",
        description=f'Willkommen {member.mention} in der Krossen Krabbe! Du bist Member Nr. {guild.member_count}\n\n'
                    f'Schรถn, dass du da bist! Bitte lies dir in Ruhe die Regeln durch.\n'
                    f'Vielleicht findest du auch hier neue Freunde!\n'
                    f'Ansonst wรผnschen wir dir einen tollen Aufenthalt! <3',
        color=discord.Color.random())
    timestamp=datetime.now().astimezone(tz=de)
    embed.set_thumbnail(url=member.avatar.url)
    embed.set_footer(
        text="Die Krosse Krabbe :jack_o_lantern:",
        icon_url="https://cdn.discordapp.com/attachments/1042479171009527948/1152980067723526316/sponge_pfp.png")

    channel = bot.get_channel(1042477256934707341)
    await channel.send(embed=embed)



if __name__ == "__main__":
    bot.load_cogs("cogs")

    load_dotenv()
    bot.run(os.getenv("TOKEN"))
urban glen
opaque blade
#

bekomme immernoch den selben error

urban glen
#

kann nicht sein

opaque blade
#
Traceback (most recent call last):
  File "c:\Users\Kai\Desktop\BullenscheiรŸe\discordserver\Bots\Spongebob_Bot\main.py", line 16, in <module>
    bot = ezcord.Bot(
  File "C:\Users\Kai\AppData\Local\Programs\Python\Python310\lib\site-packages\ezcord\bot.py", line 88, in __init__
    super().__init__(intents=intents, **kwargs)
TypeError: BotBase.__init__() missing 1 required positional argument: 'command_prefix'
urban glen
opaque blade
#

macht keinen sinn, weil dann sind mein slash commands unfunctional

urban glen
raven lotus
#

Hab sogar ein Video gefunden

opaque blade
#

und das ist das problem

urban glen
#

Inwiefern "funktionen die slash commands nicht mehr"?

#

Bekommst du errors?

opaque blade
#

nein. die slash commands sind dann einfach nicht mehr da

urban glen
#

gumo weiรŸ jemand wie man mit discord.py optionen hinzufรผgt? gibt ja zu viele mรถglichkeiten fรผr slash commands wie geht das. das ist mein code der nicht funktioniert:

@bot.tree.command(name="greet")
async def greet(ctx, user: Option(discord.User, "Der User, den du grรผรŸen mรถchtest")):
    await ctx.respond(f"Hallo {user.mention}")
urban glen
#

ja

quick osprey
ruby sparrow
urban glen
#
@bot.tree.command(name="greet")
@app_commands.describe(member="Der User, den du grรผรŸen mรถchtest")
async def greet(ctx, member: discord.Member):
    await ctx.respond(f"Hallo {member.mention}")
#

@urban glen

opaque blade
opaque blade
#

was soll mir das nun sagen?

urban glen
#

er hilft mir halt freiwillig im call pycord zu lernen mein gott

raven lotus
#

Ich habe eine Frage: Warum kommt dauernd als Antwort "Anwendung reagiert nicht" ? :

 @slash_command(description="๐Ÿ”— choose the language for the bot")
    async def language(self, ctx, local: discord.Option(str, choices=['de', 'en', 'fr'])):
        local = str(local)
        print(local)
        guild_id = int(ctx.guild.id)
        print(guild_id)
        try:
            async with aiosqlite.connect("locals.db") as db:
                async with db.execute("SELECT server_id FROM locals WHERE server_id = ?", (guild_id,)) as cursor:
                    result = str(await cursor.fetchone())
                    name = result.replace("'", "")
                    name1 = name.replace("(", "")
                    name2 = name1.replace(")", "")
                    name3 = name2.replace(",", "")
                    print(f"DB: {name3}")
                    if name3 == "None":
                        async with aiosqlite.connect("locals.db") as db:
                            await db.execute(
                                "INSERT INTO locals (server_id, local) VALUES (?, ?)", (guild_id, local)
                            )
                            await db.commit()
                            await ctx.followup.send(f"Successfully changed language to `{local}`!")
                    else:
                        async with aiosqlite.connect("locals.db") as db:
                            await db.execute(
                                "UPDATE locals SET local = ? WHERE server_id = ?", (local, guild_id)
                            )
                            await db.commit()
                            await ctx.followup.send(f"Successfully updated language to `{local}`!")
        except Exception as e:
            print(e)
urban glen
#

Error?

Maybe braucht die Interaction zu lange, bau doch mal einen defer ein

#
    @slash_command(description=":link: choose the language for the bot")
    async def language(self, ctx, local: discord.Option(str, choices=['de', 'en', 'fr'])):
        await ctx.defer()
        local = str(local)
        print(local)
        guild_id = int(ctx.guild.id)
        print(guild_id)
        try:
            async with aiosqlite.connect("locals.db") as db:
                async with db.execute("SELECT server_id FROM locals WHERE server_id = ?", (guild_id,)) as cursor:
                    result = str(await cursor.fetchone())
                    name = result.replace("'", "")
                    name1 = name.replace("(", "")
                    name2 = name1.replace(")", "")
                    name3 = name2.replace(",", "")
                    print(f"DB: {name3}")
                    if name3 == "None":
                        async with aiosqlite.connect("locals.db") as db:
                            await db.execute(
                                "INSERT INTO locals (server_id, local) VALUES (?, ?)", (guild_id, local)
                            )
                            await db.commit()
                            await ctx.followup.send(f"Successfully changed language to `{local}`!")
                    else:
                        async with aiosqlite.connect("locals.db") as db:
                            await db.execute(
                                "UPDATE locals SET local = ? WHERE server_id = ?", (local, guild_id)
                            )
                            await db.commit()
                            await ctx.followup.send(f"Successfully updated language to `{local}`!")
        except Exception as e:
            print(e)
urban glen
raven lotus
#

ich frage fรผr ein Freund

urban glen
#

Warum fragt dein Freund nicht selber?

raven lotus
#

._.

urban glen
raven lotus
#

er kann gerade nicht

urban glen
#

hmmm

raven lotus
#

:{

#

Kann mir jemand sagen, wie ich alle aus der Datenbank lade? :

    @slash_command()
    @commands.has_permissions(manage_messages=True)
    async def autodelete(self, ctx, channel: discord.TextChannel, zeit: str):
        if not channel.permissions_for(ctx.guild.me).manage_messages:
            await ctx.respond("Ich habe keine Berechtigung, Nachrichten in diesen Kanal zu verwalten", ephemeral=True)
            return

        zeit = zeit.lower()
        einheit = zeit[-1]
        zeit = int(zeit[:-1])

        if einheit == 's':
            wartezeit = zeit
            einheit_text = "Sekunde(n)"
        elif einheit == 'm':
            wartezeit = zeit * 60
            einheit_text = "Minute(n)"
        elif einheit == 'h':
            wartezeit = zeit * 3600
            einheit_text = "Stunde(n)"
        elif einheit == 'd':
            wartezeit = zeit * 86400
            einheit_text = "Tag(e)"
        else:
            await ctx.respond(
                "Ungรผltige Zeitangabe. Bitte verwende 's' fรผr Sekunden, 'm' fรผr Minuten oder 'h' fรผr Stunden.", ephemeral=True)
            return
        await ctx.respond(f"Nachrichten werden in {channel.mention} automatisch gelรถscht nach {zeit} {einheit_text}.")

        # Save autodelete information to the database
        autodelete_data = (ctx.guild.id, channel.id, wartezeit)
        self.db_cursor.execute("INSERT OR REPLACE INTO autodelete VALUES (?, ?, ?)", autodelete_data)
        self.db_connection.commit()

        @tasks.loop(seconds=wartezeit)
        async def delete_messages():
            autodelete_data = self.db_cursor.execute(
                "SELECT * FROM autodelete WHERE guild_id = ? AND channel_id = ?",
                (ctx.guild.id, channel.id)
            ).fetchone()
            if autodelete_data:
                messages = await channel.history(limit=None).flatten()
                for message in messages[::-1]:
                    if not message.pinned:
                        await message.delete()
                        break

        delete_messages.start()
dreamy bobcat
#

was ist hierbei der fehler? da kommt beim ausfรผhren immer Anwendung reagiert nicht

urban glen
#

?

dreamy bobcat
#
 @slash_command(description=":link: choose the language for the bot")
    async def language(self, ctx, local: discord.Option(str, choices=['de', 'en'])):
        await ctx.defer()
        local = str(local)
        guild_id = int(ctx.guild.id)
        try:
            async with aiosqlite.connect("locals.db") as db:
                async with db.execute("SELECT server_id FROM locals WHERE server_id = ?", (guild_id,)) as cursor:
                    result = await cursor.fetchone()
                    if result is None:
                        await db.execute("INSERT INTO locals (server_id, local) VALUES (?, ?)", (guild_id, local))
                        await db.commit()
                        await ctx.followup.send(f"Successfully changed language to `{local}`!")
                    else:
                        await db.execute("UPDATE locals SET local = ? WHERE server_id = ?", (local, guild_id))
                        await db.commit()
                        await ctx.followup.send(f"Successfully updated language to `{local}`!")
        except Exception as e:
            print(e)

urban glen
dreamy bobcat
#

nope

#

einfach nur anwendung reagier nicht in dc

urban glen
#

Versuch statt ctx.followup.send dann ctx.respond zu machen

dreamy bobcat
#

es geht jetzt. danke

#

kann man beim starten des bots sich alle server id ausprinten lassen, auf denen der server sit?

restive herald
#
for i in self.bot.guilds:
    print(i.id)

so glaube

raven lotus
#

Ich glaube ich brauche hilfe:

   @slash_command()
    @commands.has_permissions(manage_channels=True)
    @discord.default_permissions(manage_channels=True)
    async def autodelete(self, ctx, channel: discord.TextChannel, zeit: str):
        if not channel.permissions_for(ctx.guild.me).manage_messages:
            await ctx.respond("Ich habe keine Berechtigung, Nachrichten in diesen Kanal zu verwalten", ephemeral=True)
            return

        zeit = zeit.lower()
        einheit = zeit[-1]
        zeit = int(zeit[:-1])

        if einheit == 's':
            wartezeit = zeit
            einheit_text = "Sekunde(n)"
            einheit_text2 = 's'
        elif einheit == 'm':
            wartezeit = zeit * 60
            einheit_text = "Minute(n)"
            einheit_text2 = 'm'
        elif einheit == 'h':
            wartezeit = zeit * 3600
            einheit_text = "Stunde(n)"
            einheit_text2 = 'h'
        elif einheit == 'd':
            wartezeit = zeit * 86400
            einheit_text = "Tag(e)"
            einheit_text2 = 'd'
        else:
            await ctx.respond(
                "Ungรผltige Zeitangabe. Bitte verwende 's' fรผr Sekunden, 'm' fรผr Minuten oder 'h' fรผr Stunden.",
                ephemeral=True)
            return

        await ctx.respond(f"Nachrichten werden in {channel.mention} automatisch gelรถscht nach {zeit} {einheit_text}.")

        # Speichere die Informationen fรผr das automatische Lรถschen in der Datenbank
        autodelete_data = (
            ctx.guild.id, channel.id, f"{zeit}{einheit_text2}")  # Fรผge die Zeitangabe mit dem Text hinzu
        self.db_cursor.execute("INSERT OR REPLACE INTO autodelete VALUES (?, ?, ?)", autodelete_data)
        self.db_connection.commit()

        # Lade alle Eintrรคge fรผr das automatische Lรถschen aus der Datenbank
        self.db_cursor.execute("SELECT * FROM autodelete")
        all_autodelete_entries = self.db_cursor.fetchall()

        self.delete_messages.change_interval(seconds=wartezeit)

    @tasks.loop(seconds=wartezeit)
    async def delete_messages(self):
        for guild in self.bot.guilds:
            for channel in guild.text_channels:
                autodelete_data = self.db_cursor.execute(
                    "SELECT * FROM autodelete WHERE guild_id = ? AND channel_id = ?",
                    (guild.id, channel.id)
                ).fetchone()
                if autodelete_data:
                    messages = await channel.history(limit=None).flatten()
                    for message in messages[::-1]:
                        if not message.pinned:
                            await message.delete()
                            break
#

wenn ich den Bot restarte geht es nicht

#

also wenn tasks.loop unter dem command ist

blissful vale
urban glen
blissful vale
#

Sollte das Problem nochmal auftreten, dann weiรŸ er jetzt bescheid ๐Ÿ˜‰

urban glen
blissful vale
#

Gut, pycord weiรŸ ich jetzt nicht genau. Habe mir das Problem nicht vollstรคndig angeschaut! In discord.py wรผrde es so aussehen!

urban glen
twilit anvil
#

Hab mir das Button Video angesehen, wie kann ich nun den Button nur von einem Bestimmtem User benutzen lassen?

odd kiteBOT
urban glen
#

Mit nem interaction_check

#

Beispiel:

async def interaction_check(self, interaction: discord.Interaction) -> bool:
    if interaction.user.id == self.member.id:
        return True
    else:
        await interaction.response.send_message(content="You can't use this button!", ephemeral=True)
        return False

@twilit anvil

twilit anvil
#

Kann ich das mit dem Button Callback ersetzen?

urban glen
#

Nein?

#

Das kommt einfach in die View Klasse

#

Das wird vor jedem Button Klick ausgefรผhrt

twilit anvil
#

Muss dieses return True und return False da sein?

urban glen
#

รœbergibst du denn self.member?

twilit anvil
#

Ach, das muss ich?

urban glen
#

Ich weiรŸ ja nicht wie du es haben willst

#

Welcher user soll den button denn nutzen kรถnnen?

twilit anvil
#

Der, welcher den Message Command ausgefรผhrt hat

urban glen
#

ja dann musst du den Author รผbergeben

twilit anvil
# urban glen ja dann musst du den Author รผbergeben
import discord
import ezcord
import io

from discord.commands import message_command, slash_command
from discord.ext import commands
from elevenlabs import generate
from main import EMBEDCOLOR

from elevenlabs import set_api_key
set_api_key("KEY")

class AI(ezcord.Cog):

    @commands.Cog.listener()
    async def on_ready(self):
        self.bot.add_view(ButtonView())

    @message_command(name="ElevenLabs")
    @commands.cooldown(2, 600)
    async def ai(self, ctx, message):
         await ctx.defer()
         text = message.content
         audio = generate(
            text=message.content,
            voice="Adam",
            model="eleven_multilingual_v2"
         )
         embed = discord.Embed(
             description=f"**Nachricht :bluearrow: **{text}**\nVerwendete Stimme :bluearrow: Adam**",
             color=EMBEDCOLOR
         )
         embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)
         await ctx.respond(embed=embed, file=discord.File(io.BytesIO(audio), filename=f"{ctx.author.name}.mp3"), view=ButtonView(message.author))

def setup(bot: discord.Bot):
    bot.add_cog(AI(bot))

class ButtonView(discord.ui.View):
    def __init__(self, member):
        self.member = member
        super().__init__(timeout=None)
    @discord.ui.button(label="Lรถschen", style=discord.ButtonStyle.red, custom_id="delbutton")
    async def button_callback(self, button, interaction):
        async def interaction_check(self, interaction) -> bool:
            if interaction.user.id == self.member.id:
                await interaction.respond.send_message("Hallo!")
            else:
                await interaction.response.send_message(content="Nicht so schnell mein Freund! *Dieser Button ist nicht fรผr dich gedacht!*", ephemeral=True)```
#
Traceback (most recent call last):
  File "C:\Users\Leand\opengpt\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Leand\PycharmProjects\opengpt\misc\tts.py", line 17, in on_ready
    self.bot.add_view(ButtonView())
                      ^^^^^^^^^^^^
TypeError: ButtonView.__init__() missing 1 required positional argument: 'member'
twilit anvil
#

Ich weiรŸ

#

Habs behoben.

urban glen
twilit anvil
#

Kommt aber immernoch der Fehler

urban glen
#

Wieso ist es im Button Callback??

twilit anvil
#

Was?

#
 @discord.ui.button(label="Lรถschen", style=discord.ButtonStyle.red, custom_id="delbutton")
    async def button_callback(self, button, interaction):
        async def interaction_check(self, interaction) -> bool:
            if interaction.user.id == self.member.id:
                await interaction.respond.send_message("Hallo!")
            else:
                await interaction.response.send_message(content="Nicht so schnell mein Freund
#

Du meintest so

urban glen
#
import discord
import ezcord
import io

from discord.commands import message_command, slash_command
from discord.ext import commands
from elevenlabs import generate
from main import EMBEDCOLOR

from elevenlabs import set_api_key
set_api_key("KEY")

class AI(ezcord.Cog):

    @commands.Cog.listener()
    async def on_ready(self):
        self.bot.add_view(ButtonView())

    @message_command(name="ElevenLabs")
    @commands.cooldown(2, 600)
    async def ai(self, ctx, message):
         await ctx.defer()
         text = message.content
         audio = generate(
            text=message.content,
            voice="Adam",
            model="eleven_multilingual_v2"
         )
         embed = discord.Embed(
             description=f"**Nachricht :bluearrow: **{text}**\nVerwendete Stimme :bluearrow: Adam**",
             color=EMBEDCOLOR
         )
         embed.set_author(name=ctx.author.name, icon_url=ctx.author.avatar.url)
         await ctx.respond(embed=embed, file=discord.File(io.BytesIO(audio), filename=f"{ctx.author.name}.mp3"), view=ButtonView(member=ctx.author))

def setup(bot: discord.Bot):
    bot.add_cog(AI(bot))

class ButtonView(discord.ui.View):
    def __init__(self, member):
        self.member = member
        super().__init__(timeout=None)

    async def interaction_check(self, interaction) -> bool:
        if interaction.user.id == self.member.id:
            return True
        else:
            await interaction.response.send_message(content="Nicht so schnell mein Freund! *Dieser Button ist nicht fรผr dich gedacht!*", ephemeral=True)
            return False

    @discord.ui.button(label="Lรถschen", style=discord.ButtonStyle.red, custom_id="delbutton")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("Mein Button")
urban glen
twilit anvil
# urban glen nein? Wo hab ich gesagt das es in den button callback kommt, ich sagte `Das komm...
Ignoring exception in view <ButtonView timeout=None children=1> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Lรถschen' emoji=None row=None>:
Traceback (most recent call last):
  File "C:\Users\Leand\opengpt\Lib\site-packages\discord\ui\view.py", line 410, in _scheduled_task
    allow = await self.interaction_check(interaction)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Leand\PycharmProjects\opengpt\misc\tts.py", line 45, in interaction_check
    if interaction.user.id == self.member.id:
                              ^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'
twilit anvil
# urban glen Hab die nachricht bearbeitet
[ERROR] Error in event on_ready 
Traceback (most recent call last):
  File "C:\Users\Leand\opengpt\Lib\site-packages\discord\client.py", line 378, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Leand\PycharmProjects\opengpt\misc\tts.py", line 17, in on_ready
    self.bot.add_view(ButtonView())
                      ^^^^^^^^^^^^
TypeError: ButtonView.__init__() missing 1 required positional argument: 'member'
twilit anvil
# urban glen Hab die nachricht bearbeitet

So, und jetzt wieder der:```py
Ignoring exception in view <ButtonView timeout=None children=1> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Lรถschen' emoji=None row=None>:
Traceback (most recent call last):
File "C:\Users\Leand\opengpt\Lib\site-packages\discord\ui\view.py", line 410, in _scheduled_task
allow = await self.interaction_check(interaction)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leand\PycharmProjects\opengpt\misc\tts.py", line 45, in interaction_check
if interaction.user.id == self.member.id:
^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'

urban glen
#

gumo weiรŸ jemand wie man bilder aus lokalen dateien bei embeds als thumbnail nutzen kann?

#

#1027957814368423996

odd kiteBOT
#

Mein Discord Server
โ–บ https://discord.gg/zfvbjTEzv6

Links aus diesem Video
โ–บ https://media.tenor.com/epNMHGvRyHcAAAAd/gigachad-chad.gif

โ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌ
Mein Hosting* โ–บ https://tidd.ly/3gJufg6
Code auf Github โ–บ https://github.com/tibue99/tutorial-bot

PYCORD
Docs โ–บ https://docs.pycord.dev/
Guide โ–บ https://guide.pycord.dev/introduction/
D...

โ–ถ Play video
urban glen
#

danke

urban glen
#

hab diesen code hier geschrieben. mein problem ist jetzt das einfach kein bild angehรคngt ist wenn ich den command eingebe. was ist das problem hier?

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

    @slash_command()
    async def kanye(self, ctx):
        path = "kanyepics"
        imglist = os.listdir(path)
        random_img = random.choice(imglist)
        print(random_img)
        url = 'https://api.kanye.rest'
        response = requests.get(url)
        data = response.json()
        quote = data["quote"]

        embed = discord.Embed(
            title="Quote",
            description =f"*{quote}* - Kanye West",
            color= discord.Color.default()
        )

        file = discord.File(fp=f"kanyepics/{random_img}", filename="kanyepic")
        embed.set_thumbnail(url="attachment://kanyepic")

        await ctx.respond(embed=embed, file=file)
urban glen
#

gibt es ein bild was so heiรŸt?

#

ja

#

file = discord.File(fp=f"kanyepics/{random_img}", filename="kanyepic")

#

der filename ist so

#

nein das ist falsch

#

ok

#

weil du machst ja discord.File das speichert es nd ab

fringe hedge
#

hallo habe eine frage uns war kann man in ein vps server mehrere bots hosten?

urban glen
#

natรผrlich

urban glen
fringe hedge
#

und wollte fragen was ihr empfehlen wรผrdet als Anbieter

urban glen
#

dashserv, contabo

fringe hedge
urban glen
#

ja ist am besten

urban glen
#

contabo ist der partner

fringe hedge
urban glen
#

jap

#

Timo hat dazu auch ein Video

fringe hedge
odd kiteBOT
#

Mein Discord Server
โ–บ https://discord.gg/zfvbjTEzv6

Links aus diesem Video
Contabo Hosting* โ–บ https://tidd.ly/3gJufg6
Termius โ–บ https://termius.com/download/windows
MobaXterm โ–บ https://mobaxterm.mobatek.net/download.html

โ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌโ–ฌ
Commands aus dem Video

adduser tutorial
usermod -aG sudo tutorial

sudo apt update
sudo apt upgrade
...

โ–ถ Play video
twilit anvil
#

Buttons werden nicht angezeigt (keine Fehlermeldung)

urban glen
#
class ButtonView(discord.ui.View):
    def __init__(self, member):
        self.member = member
        super().__init__(timeout=None)

    async def interaction_check(self, interaction) -> bool:
        if interaction.user.id == self.member.id:
            return True
        else:
            await interaction.response.send_message(
                content="Nicht so schnell mein Freund! *Dieser Button ist nicht fรผr dich gedacht!*", ephemeral=True)
            return False


    @discord.ui.button(label="Bestrafen", style=discord.ButtonStyle.red, emoji=":banhammer:")
    async def button_callback(self, button, interaction):
        await interaction.response.send_message("`Nicht verfรผgbar!`", ephemeral=True)


    @discord.ui.button(label="Nickname รคndern", style=discord.ButtonStyle.blurple, emoji=":mention:")
    @discord.default_permissions(manage_nicknames=True)
    async def button_callback1(self, button, interaction):
        def check(message):
            return message.author == interaction.user and message.channel == interaction.channel
        try:
            response = await interaction.client.wait_for('message', check=check, timeout=30)
            limit = int(response.content)
            if 0 < limit <= 99:
                voice_channel = interaction.message.channel
                await self.member.edit(nickname=response)
            else:
                await interaction.followup.send("Ungรผltige Eingabe. Bitte gib eine Zahl zwischen 1 und 99 ein.",
                                                ephemeral=True)
        except asyncio.TimeoutError:
            await interaction.followup.send("Zeitlimit รผberschritten. Bitte versuche es erneut.", ephemeral=True)
        except ValueError:
            await interaction.followup.send("Ungรผltige Eingabe. Bitte gib eine Zahl zwischen 1 und 99 ein.", ephemeral=True)
twilit anvil
#

Danke :^)

twilit anvil
opaque blade
#

Kann mir vllt wer helfen? Arbeite gerade an einem Verify System mit Nextcord und einer Database

nextcord.ext.commands.errors.ExtensionFailed: Extension 'ezcord.cogs.help' raised an error: AttributeError: module 'discord' has no attribute 'ApplicationContext'
urban glen
opaque blade
#

oben bei den imports oder wo?

urban glen
#

._.

opaque blade
#

sorry fange erst gerade an

urban glen
#

gibt es diese art buttons zu erstellen noch? weil die tutorials alle sehr als sind und es bei mir irgendwie nicht funktioniert.

urban glen
#

ich bin da zu blรถd fรผr

#

bin nicht so gut in python

#

fรผr das was ich machen will ist das so kompliziert

wind finch
urban glen
#

ein quiz

#

mit 3 antwortmรถglichkeiten als button

wind finch
urban glen
#

wie bekomme ich denn von der einen klasse die antwort in die discord.ui.View klasse

#

ich hab ein array mit den antworten

#

und wie bekomme checke ich ob die antwort richtig ist

#

wรผsste garnicht wie ich vorgehen muss

urban glen
#

die cog klasse

wind finch
urban glen
#

ja aber ich muss das dann in ne andere klasse machen so

#

weil danach muss ich ja die funktion nochmal aufrufen um die nรคchste frage zu schicken

wind finch
urban glen
#

ich benutze ja pycord

#

oder ist das auch kompatibel?

wind finch
#

Muss man umschreiben aber da siehst du wie man sowas aufbauen kann.

opaque blade
urban glen
#

das kann ich nicht

urban glen
ruby sparrow
#

@opaque blade

opaque blade
ruby sparrow
opaque blade
#

alles gut

solid ingot
opaque blade
ruby sparrow
urban glen
tawdry leaf
#

aua

#

mit edding auf Bildschirm ๐Ÿ˜„

opaque blade
#

oder fck it ich mache nen neuen bot dazu, weil booster hab ich 3 server offen

opaque blade
#

weil dann kann ich das in nextcord machen und behalte meine commands yk?

tawdry leaf
#

๐Ÿค”

boreal maple
#

Moin, und zwar mรถchte ich einen Bot fรผr nen Server machen welcher ein Dashboard haben soll (fragt mich nicht warum ich mach's mal einfach) und ich da mรถchte ich nun folgendes machen und zwar kann man im Dashboard den Bot Status setzen welches รผber ein Textfeld eingegeben werden kann kann mir da wer weiterhelfen.

Code: (bot.py)

@Server.route()
    async def edit_status(self, state: str):
        if state == "default":
            await self.change_presence(activity=discord.CustomActivity(name=f"Bot by eynoah | NexusPvP our PvP FiveM Server", emoji=PartialEmoji(name="๐Ÿ˜"), status=discord.Status.dnd))
        elif state == "noah":
            await self.change_presence(
                activity=discord.CustomActivity(name=f"Noah is the Coolest Guy ever seen! :)",
                                                emoji=PartialEmoji(name="๐Ÿ˜"), status=discord.Status.dnd))

Code: (main.py)

@app.get("/dashboard/bot/toggleState")
async def edit_state(state: str, request: Request):
    if state == "default":
        return templates.TemplateResponse(
            "bot.html",
            {
                "request": request,
                "state": state
            }
        )
    elif state == "noah":
        return templates.TemplateResponse(
            "bot.html",
            {
                "request": request,
                "state": state
            }
        )
    else:
        return templates.TemplateResponse(
            "bot.html",
            {
                "request": request,
                "state": "None"
            }
        )
twilit anvil
#
Ignoring exception in view <ButtonView timeout=None children=1> for item <Button style=<ButtonStyle.secondary: 2> url=None disabled=True label='Entbannen' emoji=<PartialEmoji animated=False name='banhammer' id=1167507347741085736> row=None>:
Traceback (most recent call last):
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 421, in _scheduled_task
    await item.callback(interaction)
  File "C:\Users\Leand\PycharmProjects\clyde\moderation\ban.py", line 42, in button_callback
    await self.member.unban(reason="Entbannung per Button")
          ^^^^^^^^^^^^^^^^^
AttributeError: 'User' object has no attribute 'unban'
#
import discord
import ezcord
import emojis

from discord.ext import commands
from discord.commands import slash_command, option
class Base(ezcord.Cog):

    @commands.Cog.listener()
    async def on_ready(self):
        self.bot.add_view(ButtonView(member=None))

    @slash_command(description="hello")
    @option("user", description="Der Nutzer, den du Bannen mรถchtest")
    @option("reason", description="Der Grund, weshalb du den Nutzer bannst")
    @discord.default_permissions(ban_members=True)
    @commands.bot_has_permissions(ban_members=True)
    async def ban(self, ctx, user: discord.Member, reason: str):
        embed = discord.Embed(
            description=f"{emojis.banhammer} **BEEP!** Mitglied gebannt!",
            color=0x74b454
        )
        lembed = discord.Embed(
            color=0x3b76c4
        )
        lembed.add_field(name="Benutzer", value=f"```yaml\nBenutzername: {user.name}\nAnzeigename: {user.display_name}\nID: {user.id}\n```", inline=False)
        lembed.add_field(name="Grund", value=f"```yaml\n{reason}\n```", inline=False)

        await ctx.respond(embeds=[embed, lembed], view=ButtonView(member=user))
def setup(bot: discord.Bot):
    bot.add_cog(Base(bot))

class ButtonView(discord.ui.View):
    def __init__(self, member):
        self.member = member
        super().__init__(timeout=None)

    @discord.ui.button(label="Entbannen", style=discord.ButtonStyle.grey, emoji=emojis.banhammer, custom_id="UnbanButton")
    @discord.default_permissions(ban_members=True)
    async def button_callback(self, button, interaction):
        button.disabled = True
        await self.member.unban(reason="Entbannung per Button")

        await interaction.followup.send(f"{self.member.mention} wurde entbannt!", ephemeral=True)
urban glen
#

interaction.guild.unban(self.member) glaube

odd kiteBOT
normal sundial
#

wenn ich meinen bot jetzt mit dem dashboard verbinden will also meinen bestehenden bot. und der bot ja in einer eigenen main lief muss ich dann jetzt einfach das was in der main stand in die bot.py schreiben? in die class?

#

und da ich in der main.py ja ```py
if name == "main":
for filename in os.listdir(f"./Cogs"):
if filename.endswith(f".py"):
bot.load_extension(f"Cogs.{filename[:-3]}")
load_dotenv()
bot.run(os.getenv("TOKEN"))

 habe in was รคndere ich das?
fierce dove
#

Kann automod auch Leute bannen

raven lotus
#

Kann man mit einem Code die Bannerfarbe von einem รคndern?

raven lotus
#

Nein

#

Vom Bot

urban glen
#

Ah, deine Frage hรถrt sich anders an

raven lotus
#

Autokorrektur

urban glen
#

Aber nein, dass geht auch nicht
Meines wissens nach

raven lotus
#

Aber irgendwie geht es bei anderen Bots

#

Ich weiรŸ aber nicht wie

urban glen
#

hm?

raven lotus
#

Waaaait

#

Digga hat DC wieder ein neues Update bei Bots

#

Alle Banner sind schwarz

raven lotus
#

Hรค

#

War bei mir mal weiรŸ

fierce dove
raven lotus
#

Idk

#

Ich starte mal neu

fierce dove
#

Ok

raven lotus
#

Bei mir haben alle Keks Bots schwarze Banner

fierce dove
#

Zeig

#

Bild

raven lotus
#

Bin am Handy

fierce dove
#

Ok

raven lotus
#

Bei mir ist das schwarz

urban glen
raven lotus
#

Und da steht statt "dem Server hinzufรผgen" "Add App"

fierce dove
#

Hmmmm

kind depot
raven lotus
#

Hat mich komplett irritiert

#

Hab gedacht das es eine Application wรคre oder so

#

Bei einem anderen Bot

kind depot
#

okee

#

mich hat das auch iritiert..

twilit anvil
#
[ERROR] Error while executing /windows problembehandlung 
Traceback (most recent call last):
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 131, in wrapped
    ret = await coro(arg)
          ^^^^^^^^^^^^^^^
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\commands\core.py", line 1000, in _invoke
    await self.callback(self.cog, ctx, **kwargs)
  File "C:\Users\Leand\PycharmProjects\clyde\modules\Problembehandlung.py", line 22, in problembehandlung
    await respond.edit("Hallo!")
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\interactions.py", line 592, in edit
    return await self.edit_original_response(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Interaction.edit_original_response() takes 1 positional argument but 2 were given
#
import discord
import ezcord
import random
import asyncio

from discord.ext import commands
from discord.commands import SlashCommandGroup
class PrOBlEmBEhaNdlUnG(ezcord.Cog):
    windows = SlashCommandGroup("windows")

    @windows.command(description="hello")
    async def problembehandlung(self, ctx):
        embed = discord.Embed(
            title="Probleme werden gesucht...",
            color=discord.Color.blurple(),
            description="Bitte haben Sie einen kleinen moment Geduld."
        )
        respond = await ctx.respond(embed=embed)

        await asyncio.sleep(10)

        await respond.edit("Hallo!")

def setup(bot: discord.Bot):
    bot.add_cog(PrOBlEmBEhaNdlUnG(bot))
#

Fragt nicht was das fรผr ein Command ist, xD.

#

Auf jedenfall tritt der Fehler auf, wenn ich die Nachricht nach einer gewissen Zeit bearbeiten mรถchte.

urban glen
twilit anvil
urban glen
lofty rock
#
Traceback (most recent call last):
  File "/home/container/main.py", line 5, in <module>
    import discord_components
  File "/home/container/discord_components/__init__.py", line 1, in <module>
    from .client import *
  File "/home/container/discord_components/client.py", line 12, in <module>
    from .component import Component
  File "/home/container/discord_components/component.py", line 3, in <module>
    from discord import PartialEmoji, Emoji, InvalidArgument
ImportError: cannot import name 'InvalidArgument' from 'discord' (/home/container/.local/lib/python3.10/site-packages/discord/__init__.py)
container@pterodactyl~ Server marked as offline...```
native plume
#

Nvm liegt aber am Import PartialEmoji, HIER

urban glen
#

Schick mal deine requirements.txt

#

oder deine pip freeze

urban glen
#

Also entferne import discord_components

lofty rock
odd kiteBOT
raven lotus
#

wie ladet man nochmal was aus einer .env datei?

graceful fiber
#

Sollte eigentlich selbst erklรคrend sein wie das Modul funktioniert?

raven lotus
#

habs vergessen cursedpepe

#

wie soll das aussehen?

#

weil das hier geht net:

bot.run(dotenv=('TOKEN'))
graceful fiber
#

Musst das Modul natรผrlich auch importieren

raven lotus
#

Ja

graceful fiber
raven lotus
#

wie?

graceful fiber
#

ja einfach mal selbst lesen kurz

#

erst musst du natรผrlich laden und dann getten

#

kannst dafรผr os nutzen

raven lotus
#

habs gelesen

graceful fiber
#

dann solltest du jetzt ja alles wissen ^^

raven lotus
#

naja, fast

graceful fiber
ruby sparrow
#
bot.run(os.getenv("TOKEN"))```
#

@raven lotus

raven lotus
#

TypeError: token must be of type str, not NoneType

#
if __name__ == "__main__":
    bot.load_cogs
    bot.run(os.getenv("TOKEN"))
graceful fiber
#

aber auch gut dogSmile

ruby sparrow
#

sein

#
TOKEN = dein token ```
#

@raven lotus

raven lotus
#

hab ich so

ruby sparrow
urban glen
#

@raven lotus in deiner .env?

#

machst du auch load_dotenv()? (from dotenv import load_dotenv)

raven lotus
#

ja

graceful fiber
graceful fiber
ruby sparrow
#

in .env

quick osprey
#

{
"token": "Hier token"
}

urban glen
#

bist du dumm

ruby sparrow
urban glen
#

das ist eine json

fierce dove
raven lotus
#

.-.

ruby sparrow
#

kann wer sagen wie geht das auf Englische Tastatur auf 60% []

ruby sparrow
#

[]

#

die

opaque blade
#

oder rechts gibt es dir

ruby sparrow
#

ja

#

gehts es aber ich weiss nicht wie macht

opaque blade
#

hรครครค einfach auf die Taste drรผcken??

raven lotus
#

Ich brauche kurz mal Hilfe:

    @tasks.loop(seconds=1)
    async def delete_messages(self):
        for channel in self.bot.get_all_channels():
            autodelete_data = self.db_cursor.execute(
                "SELECT * FROM autodelete WHERE channel_id = ?, interval = ?",
                (channel.id, interval)
            ).fetchone()
            if autodelete_data:
                interval = autodelete_data[1]
                messages = await channel.history(limit=None).flatten()
                for message in messages[::-1]:
                    if not message.pinned:
                        await message.delete()
                        break
                zeit = interval.lower()
                einheit = zeit[-1]
                zeit = int(zeit[:-1])
                if einheit == 's':
                    wartezeit = zeit
                elif einheit == 'm':
                    wartezeit = zeit * 60
                elif einheit == 'h':
                    wartezeit = zeit * 3600
                elif einheit == 'd':
                    wartezeit = zeit * 86400
                self.delete_messages.change_interval(seconds=wartezeit)
solid ingot
#

bei was denn?

raven lotus
#

wait

#
    @slash_command(description="๐Ÿงบ โ— Setze einen Autodelete-Channel")
    @commands.has_permissions(manage_channels=True)
    @discord.default_permissions(manage_channels=True)
    async def autodelete(self, ctx, channel: discord.TextChannel, zeit: str):
        if not channel.permissions_for(ctx.guild.me).manage_messages:
            await ctx.respond("Ich habe keine Berechtigung, Nachrichten in diesen Kanal zu verwalten", ephemeral=True)
            return

        zeit = zeit.lower()
        einheit = zeit[-1]
        zeit = int(zeit[:-1])

        if einheit == 's':
            wartezeit = zeit
            einheit_text = "Sekunde(n)"
            einheit_text2 = 's'
        elif einheit == 'm':
            wartezeit = zeit * 60
            einheit_text = "Minute(n)"
            einheit_text2 = 'm'
        elif einheit == 'h':
            wartezeit = zeit * 3600
            einheit_text = "Stunde(n)"
            einheit_text2 = 'h'
        elif einheit == 'd':
            wartezeit = zeit * 86400
            einheit_text = "Tag(e)"
            einheit_text2 = 'd'
        else:
            await ctx.respond(
                "Ungรผltige Zeitangabe. Bitte verwende 's' fรผr Sekunden, 'm' fรผr Minuten oder 'h' fรผr Stunden.",
                ephemeral=True)
            return

        await ctx.respond(f"Nachrichten werden in {channel.mention} automatisch gelรถscht nach {zeit} {einheit_text}.")

        # Speichere die Informationen fรผr das automatische Lรถschen in der Datenbank
        autodelete_data = (
            ctx.guild.id, channel.id, f"{zeit}{einheit_text2}")  # Fรผge die Zeitangabe mit dem Text hinzu
        self.db_cursor.execute("INSERT OR REPLACE INTO autodelete VALUES (?, ?, ?)", autodelete_data)
        self.db_connection.commit()

        # Lade alle Eintrรคge fรผr das automatische Lรถschen aus der Datenbank
        self.db_cursor.execute("SELECT * FROM autodelete")
        all_autodelete_entries = self.db_cursor.fetchall()

        self.delete_messages.change_interval(seconds=wartezeit)
``` es soll je nach ausgewรคhlte zeit im ausgewรคhlten channel eine Nachricht gelรถscht werden
opaque blade
#

Mooooin, kann mir wer helfen und sagen was dieser Error mir sagen will und was ich fixen kann?

nextcord.ext.commands.errors.ExtensionFailed: Extension 'ezcord.cogs.help' raised an error: AttributeError: module 'discord' has no attribute 'ApplicationContext'
urban glen
opaque blade
#

hab ich auch nicht im code stehen

urban glen
last depot
#

Hey ich habe so ein error aber idk was das heiรŸt:

PS C:\Users\felix\Desktop\F_webpanel> python main.py
Traceback (most recent call last):
  File "C:\Users\felix\Desktop\F_webpanel\main.py", line 10, in <module>
    from backend import DiscordAuth, db
  File "C:\Users\felix\Desktop\F_webpanel\backend\__init__.py", line 1, in <module>
    from .api import DiscordAuth
  File "C:\Users\felix\Desktop\F_webpanel\backend\api.py", line 31
    return await response.json()
    ^
IndentationError: expected an indented block after 'if' statement on line 29
PS C:\Users\felix\Desktop\F_webpanel> 

Code

class DiscordAuth:
    client_id: str
    client_secret: str
    redirect_uri: str
    session: aiohttp.ClientSession | None

    def __init__(self, client_id, client_secret, redirect_uri):
        self.client_id = client_id
        self.client_secret = client_secret
        self.redirect_uri = redirect_uri

        self.auth = aiohttp.BasicAuth(str(client_id), client_secret)

    async def setup(self):
        self.session = aiohttp.ClientSession()

    async def get_user(self, token):
        headers = {"Authorization": f"Bearer {token}"}
        async with self.session.get(API_ENDPOINT + "/users/@me", headers=headers) as response:
            return await response.json()

    async def get_guilds(self, token):
        headers = {"Authorization": f"Bearer {token}"}
        async with self.session.get(API_ENDPOINT + "/users/@me/guilds", headers=headers) as response:
            if response.status == 429:
                raise HTTPException(status_code=429)
            return await response.json()
#

habs gefixxt trozdem dankeherzen_ws

last depot
#

Was habe ich falsch gemacht ?

**error: **

row=None>:
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\felix\Desktop\Neuer Test Bot\cogs\ticket.py", line 262, in button_callback1
    link =  await chat_exporter.link(message)
                                     ^^^^^^^
UnboundLocalError: cannot access local variable 'message' where it is not associated with a value

Code


    @discord.ui.button(label="Lรถschen", style=discord.ButtonStyle.primary, emoji="๐Ÿ—‘๏ธ")
    async def button_callback1(self, button, interaction):
        lรถschembed = discord.Embed(
            title="Ticket Lรถschen",
            description=f"> {interaction.user.mention} hat das Ticket gelรถscht!",
            color=discord.Color.red(),
            timestamp=datetime.utcnow()
        )

        await interaction.response.send_message(embed=lรถschembed)

        userid = interaction.channel.topic
        ticketuser = await interaction.client.fetch_user(userid)

        await asyncio.sleep(5)


        transcript = await chat_exporter.export(
            interaction.channel,
            limit=None,
            tz_info="CET",
            military_time=True
        )

        if transcript is None:
            return

        transcript_file = discord.File(
            io.BytesIO(transcript.encode()),
            filename=f"transcript_{interaction.channel.name}.html"
        )

        transcript_file2 = discord.File(
            io.BytesIO(transcript.encode()),
            filename=f"transcript_{interaction.channel.name}.html"
        )

        
        channel = await interaction.client.fetch_channel(int(get_config("Log_Channel")))
 


     

        await interaction.channel.delete()
        link =  await chat_exporter.link(message)
        message = await channel.send(embed=feedbackembed)

        feedbackembed = discord.Embed(
            title="Ticket wurde geschlossen",
            description=f"> Ticket wurde von {interaction.user.mention} geschlossen",
            color=0x1067a3,
            timestamp=datetime.now()
        )

        feedbackembed.add_field(name="User", value=f"{ticketuser}")
        feedbackembed.add_field(name="Category", value=f"{channel}")
        feedbackembed.add_field(name="Transcript", value=f"[hier]({link})")


        await ticketuser.send(embed=feedbackembed)
solid ingot
#

du versuchst du message erst zu benutzen, und danach zu definieren

last depot
#

Jetzt kommt der error

Ignoring exception in view <Ticketclose timeout=None children=2> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='Lรถschen' emoji=<PartialEmoji animated=False name='๐Ÿ—‘๏ธ' id=None> 
row=None>:
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\felix\Desktop\Neuer Test Bot\cogs\ticket.py", line 259, in button_callback1
    message = await channel.send(embed=feedbackembed)
                                       ^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'feedbackembed' where it is not associated with a value

code;

class Ticketclose(discord.ui.View):
    def __init__(self):
        super().__init__(timeout=None)
     

    @discord.ui.button(label="Lรถschen", style=discord.ButtonStyle.primary, emoji="๐Ÿ—‘๏ธ")
    async def button_callback1(self, button, interaction):
        lรถschembed = discord.Embed(
            title="Ticket Lรถschen",
            description=f"> {interaction.user.mention} hat das Ticket gelรถscht!",
            color=discord.Color.red(),
            timestamp=datetime.utcnow()
        )

        await interaction.response.send_message(embed=lรถschembed)

        userid = interaction.channel.topic
        ticketuser = await interaction.client.fetch_user(userid)

        await asyncio.sleep(5)


        transcript = await chat_exporter.export(
            interaction.channel,
            limit=None,
            tz_info="CET",
            military_time=True
        )

        if transcript is None:
            return

        transcript_file = discord.File(
            io.BytesIO(transcript.encode()),
            filename=f"transcript_{interaction.channel.name}.html"
        )

        transcript_file2 = discord.File(
            io.BytesIO(transcript.encode()),
            filename=f"transcript_{interaction.channel.name}.html"
        )

        
        channel = await interaction.client.fetch_channel(int(get_config("Log_Channel")))
 

        await interaction.channel.delete()
        message = await channel.send(embed=feedbackembed)
        link =  await chat_exporter.link(message)
        
        feedbackembed = discord.Embed(
            title="Ticket wurde geschlossen",
            description=f"> Ticket wurde von {interaction.user.mention} geschlossen",
            color=0x1067a3,
            timestamp=datetime.now()
        )

        feedbackembed.add_field(name="User", value=f"{ticketuser}")
        feedbackembed.add_field(name="Category", value=f"{channel}")
        feedbackembed.add_field(name="Transcript", value=f"[hier]({link})")

     
  
        await ticketuser.send(embed=feedbackembed)
solid ingot
#

wieder dasselbe, bevor du sachen benutzen kannst, musst du sie erst erstellen

#

du kannst feedbackembed also erst nutzen, nachdem du die variable erstellt hast

last depot
#

Also so?

  channel = await interaction.client.fetch_channel(int(get_config("Log_Channel")))
 

        await interaction.channel.delete()
        link =  await chat_exporter.link(message)
        
        feedbackembed = discord.Embed(
            title="Ticket wurde geschlossen",
            description=f"> Ticket wurde von {interaction.user.mention} geschlossen",
            color=0x1067a3,
            timestamp=datetime.now()
        )

        feedbackembed.add_field(name="User", value=f"{ticketuser}")
        feedbackembed.add_field(name="Category", value=f"{channel}")
        feedbackembed.add_field(name="Transcript", value=f"[hier]({link})")

        message = await channel.send(embed=feedbackembed)
  
        await ticketuser.send(embed=feedbackembed)
#

ahh link muss auch runter nh?

#
Ignoring exception in view <Ticketclose timeout=None children=2> for item <Button style=<ButtonStyle.primary: 1> url=None disabled=False label='Lรถschen' emoji=<PartialEmoji animated=False name='๐Ÿ—‘๏ธ' id=None> 
row=None>:
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\felix\Desktop\Neuer Test Bot\cogs\ticket.py", line 270, in button_callback1
    feedbackembed.add_field(name="Transcript", value=f"[hier]({link})")
                                                     ^^^^^^^^^^^^^^^^^
UnboundLocalError: cannot access local variable 'link' where it is not associated with a value
#

jetzt kommt das wo ich beide runter gemachjt habr

#
     channel = await interaction.client.fetch_channel(int(get_config("Log_Channel")))
 

        await interaction.channel.delete()
        
        
        feedbackembed = discord.Embed(
            title="Ticket wurde geschlossen",
            description=f"> Ticket wurde von {interaction.user.mention} geschlossen",
            color=0x1067a3,
            timestamp=datetime.now()
        )

        feedbackembed.add_field(name="User", value=f"{ticketuser}")
        feedbackembed.add_field(name="Category", value=f"{channel}")
        feedbackembed.add_field(name="Transcript", value=f"[hier]({link})")
        message = await channel.send(embed=feedbackembed)
        link =  await chat_exporter.link(message)
      
        await ticketuser.send(embed=feedbackembed)
#

also so

urban glen
last depot
#

HAb das jetzt so gemacht aber jetzt kommt das

#
Traceback (most recent call last):
  File "C:\Users\felix\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ui\view.py", line 414, in _scheduled_task
    await item.callback(interaction)
  File "c:\Users\felix\Desktop\Neuer Test Bot\cogs\ticket.py", line 268, in button_callback1
    link =  await chat_exporter.link(message)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\felix\AppData\Local\Programs\Python\Python311\Lib\site-packages\chat_exporter\chat_exporter.py", line 170, in link
    return "https://mahto.id/chat-exporter?url=" + message.attachments[0].url
                                                   ~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
#

code

        channel = await interaction.client.fetch_channel(int(get_config("Log_Channel")))
 

        await interaction.channel.delete()
        
        
        feedbackembed = discord.Embed(
            title="Ticket wurde geschlossen",
            description=f"> Ticket wurde von {interaction.user.mention} geschlossen",
            color=0x1067a3,
            timestamp=datetime.now()
        )
        message = await channel.send(embed=feedbackembed)
        link =  await chat_exporter.link(message)
        feedbackembed.add_field(name="User", value=f"{ticketuser}")
        feedbackembed.add_field(name="Category", value=f"{channel}")
        feedbackembed.add_field(name="Transcript", value=f"[hier]({link})")
       
        
        await ticketuser.send(embed=feedbackembed)
#

Das ist mein transcript:

 transcript = await chat_exporter.export(
            interaction.channel,
            limit=None,
            tz_info="CET",
            military_time=True
        )

        if transcript is None:
            return

        transcript_file = discord.File(
            io.BytesIO(transcript.encode()),
            filename=f"transcript_{interaction.channel.name}.html"
        )

        transcript_file2 = discord.File(
            io.BytesIO(transcript.encode()),
            filename=f"transcript_{interaction.channel.name}.html"
        )
vernal rampart
#

was heiรŸt: AttributeError: 'list' object has no attribute 'to_dict'

vernal rampart
native plume
#

Aus welcher Zeile ist denn der Error?

vernal rampart
#

281

urban glen
native plume
#

Mach mal Str + F fรผr das to_dict

#

Und schick den Codeabschnitt davon

vernal rampart
# urban glen Dann schick am besten nur die Zeilen, wo du vermutest das da der Fehler auftritt
@button
        allgames = self.steam.users.get_owned_games(self.user['steamid'])
        allgamelist = allgames['games']
        print(allgames['games'])
        print(len(allgames['games']))
        game_count = len(allgames['games'])
        if game_count == "0" or 0:
            leer = f"{self.user['personaname']} hat **keine Spiele** oder sein Profil ist auf **Privat** gestellt."
            embed = discord.Embed(
                        title=f"Privat",
                        description=leer,
                        color=discord.Color.red())
            try:
                image = self.user["avatarfull"]
            except:
                image = None
                pass
            if image is not None:
                embed.set_thumbnail(url=image)
            await interaction.response.send_message(embed=embed)
            return
        pages = []
        desc = ""
        user = steam.users.get_user_details(f"{self.steamid}")
        print(user['player']['steamid'])
        for index, game in enumerate(allgamelist):
            print(game['appid'])
            print(game)
            print(index)
            try:
                zeit = f"  - Spielzeit Letzten 2 Wochen: **{game['playtime_2weeks']} Stunden**.\n"
            except:
                zeit = ""
            desc += f"- **{game['name']}**\n    - Spielzeit insgesamt: **{game['playtime_forever']} Stunden**.\n{zeit}\n"
            if (index + 1) % 10 == 0:
                embed = [discord.Embed(
                    title=f"Alle Games von {self.user['personaname']}",
                    description=desc,
                    color=discord.Color.purple()
                )]
                page = Page(embeds=[embed])
                pages.append(page)
                desc = ""
        paginator = Paginator(pages=pages, show_disabled=False, disable_on_timeout=True, timeout=180, author_check=True)
        await paginator.respond(self.ctx.interaction)
#

oben gekรผrzt

#

wegen discord

fringe hedge
#

hallo Leute, kann man in ein embed mehrere Bilder hinzufรผgen z.b nicht set_img sondern add_img gibt es sowas oder kann man das mit eine Methode machen?

urban glen
#

leider nein, man kann nur ein bild zugleich haben

fringe hedge
fringe hedge
urban glen
#

hmm, ne das macht eig. kein sinn
auรŸer:

Die URL des bilds gibt es nicht mehr
Sprich; du hast das bild bei discord hochgeladen und verwendest diese URL, nach dem du es gelรถscht hast, dauerts paar minuten und es ist dann weg
gleiches gillt fรผr andere methoden

fringe hedge
urban glen
#

du schickst das bild in irgendeinen channel

kopierst die URL
machst im code dann:

... url='...'

#

ich weiรŸ ja nicht wie dein code aussieht also kann ich da ned wirklich was zu sagen

#

bei em.set_image(url='..')
funktionierts jedenfalls

#

bzw bei anderen sachen wo man das keyword 'url=' hat

fringe hedge
#
url = message.attachments[0].url
await channel.send(url)
await message.delete()```
das ist mein code z.b
urban glen
#

mach:

url = 'die bild url'
await channel.send(url)
fringe hedge
urban glen
#

viel erfolg

fringe hedge
urban glen
#

ne

#

du uploadest das bild

#

in irgendeinen channel

#

bsp:

fringe hedge
urban glen
#

klickst auf das bild

fringe hedge
#

HUH

urban glen
#

und machst das:

fringe hedge
urban glen
#

diese URL kopieren

#

und dann abfahrt in deinen code

fringe hedge
urban glen
urban glen
fringe hedge
# urban glen wie meinst

ich sende in den Chanel 1000+ msg's ich kann es ja net fรผr jedes einzelne Bild kopieren etc. das dauert zu lange yk

urban glen
#

check ich ned

#

mach doch einfach ganz oben in die init methode:


self.pic = 'url'
#

und dann bei jedem code teil wo du das bild brauchst

#

anstelle deines aktuellen stuff

#

channel.send(self.pic)

#

dann hast du es einmalig und ist fรผr alles

fringe hedge
#

und bei mehreren Bilder was mache ich da @urban glen ?

urban glen
#

in die innit methode das gleiche bloรŸ mit self.pic1 ect

dann da halt verwenden

#

was anderes kรถnnte ich dir jetzt nicht vorschlagen

#

mรผsstest auf wen anderes dann warten

fringe hedge
snow hatch
#

Moin,
Wollte das versucht wird einen user eine dm zu schicken und wenns nicht klappt solls ignoriert werden
Kriege trotzdem einen fehler code, wieso?

        ch = user.dm_channel
        if ch is None:
            ch = await user.create_dm()
        try:
            await ch.send(embed=dm)
        except discord.HTTPException:
            pass```
```py
discord.errors.ApplicationCommandInvokeError: Application Command raised an exception: HTTPException: 400 Bad Request (error code: 50007): Cannot send messages to this user
opaque blade
#

Meine prediction: Der user hat DM aus

snow hatch
#

ja aber ich meine wieso klappt das nicht mit dem try und exept, das er dann anstatt das try einfach das except macht und die fehlermeldung nicht sendet

solid ingot
#

in welcher Zeile ist denn genau der Error? vlt tritt der Error ja schon bei create_dm auf

#

du kannst aber auch direkt user.send schreiben

opaque blade
#

Wenn ja kann ich dir vllt meine requirements und meinen Code schicken weil ichd en etwas abgeaendert hab

snow hatch
snow hatch
#

ist es dann irgendwie mรถglich den fehler zu ignorieren

snow hatch
solid ingot
solid ingot
#

naja das mit dem dm_channel steht nicht im try except

twilit anvil
#

Moin! Wollte es mir etwas leichter machen, alle WebHooks zu entfernen, funktioniert aber leider nicht.

Error:```py
C:\Users\Leand\PycharmProjects\kompetenz\modules\pingr.py:42: RuntimeWarning: coroutine 'Guild.webhooks' was never awaited
for webhook in ctx.guild.webhooks():
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Ignoring exception in command ping:
Traceback (most recent call last):
File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 178, in wrapped
ret = await coro(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Leand\PycharmProjects\kompetenz\modules\pingr.py", line 42, in ping
for webhook in ctx.guild.webhooks():
TypeError: 'coroutine' object is not iterable

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

Traceback (most recent call last):
File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\bot.py", line 347, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 950, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 187, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'coroutine' object is not iterable


Code:```py
@commands.command()
    async def ping(self, ctx):
        for i in range(500):
            for webhook in ctx.guild.webhooks():
                await webhook.delete()
        await ctx.author.send(f"Pong! `{round(self.bot.latency * 1000)}ms`")
odd kiteBOT
urban glen
#

Es is asyncron, also musst du ctx.guild.webhooks awaiten

#

Is aber eine weirde Funktion in einem "ping" command ._.

twilit anvil
#
Ignoring exception in command ping:
Traceback (most recent call last):
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 178, in wrapped
    ret = await coro(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Leand\PycharmProjects\kompetenz\modules\pingr.py", line 42, in ping
    for webhook in ctx.guild.webhooks:
TypeError: 'method' object is not iterable

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

Traceback (most recent call last):
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\bot.py", line 347, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 950, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Leand\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\ext\commands\core.py", line 187, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'method' object is not iterable
#

hab das in await vergessen ._.

urban glen
#
@commands.command()
async def ping(self, ctx):
    webhooks = await ctx.guild.webhooks()
    for i in range(500):
        for webhook in webhooks:
            await webhook.delete()
    
    await ctx.author.send(f"Pong! `{round(self.bot.latency * 1000)}ms`")

Probiers so

urban glen
twilit anvil
#

jetzt gehts.

#

danke

urban glen
#

yoo leute:
wie erstelle ich einen neuen post bei nem forum?
bin zu blรถd dafรผr...

solid ingot
#

du klickst auf den "neuer post" button