#๐Ÿ”’ discord bot

11 messages ยท Page 1 of 1 (latest)

toxic mason
#

async def send_discord_message(guild_id, channel_name, video_path, mesaj):
for a in asd:
channel_count = len(category.channels)
if channel_count < 5:
channel = discord.utils.get(guild.channels, name=channel_name, category=category)
if channel is None:
overwrites = {guild.default_role: discord.PermissionOverwrite(send_messages=False)}
channel = await guild.create_text_channel(channel_name, category=category,overwrites=overwrites)
with open(video_path, 'rb') as file:
file = discord.File(file)
await channel.send(content=mesaj, file=file)
print("as")
break

async def main():
await send_discord_message(1234206964267876465,"denemevwtjcecq",video, "denemec")

asyncio.run(main())
print("hi")

hi break doesnt working program freezing "for" need be break if i doesnt use break program doesnt run anyway but print("hi") to doesnt to
work

astral impBOT
#

@toxic mason

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

haughty cove
astral impBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

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

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

For long code samples, you can use our pastebin.

haughty cove
#

!traceback for error

astral impBOT
#
Traceback

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

haughty cove
#

also its probably because you're passing through an integer and not a guild object

#

!d discord.Guild for more info

astral impBOT
#

class discord.Guild```
Represents a Discord guild.

This is referred to as a โ€œserverโ€ in the official Discord UI.

x == y Checks if two guilds are equal.

x != y Checks if two guilds are not equal.

hash(x) Returns the guildโ€™s hash.

str(x) Returns the guildโ€™s name.
astral impBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.