Почему отсутствует модуль discord.ext?
Переустанавливал питон, discord.py, менял названия файлов и папки, но ошибка до сих пор
Код:
import discord from discord.еxt import commands import random class gifs18(commands.Cog): def __init__(self, bot): self.bot = bot self._last_member = None
И выдает эту ошикбу:
Возникло исключение: ModuleNotFoundError No module named 'discord.еxt' File "D:\PIVNUSHKA\gid.py", line 2, in from discord.еxt import commands
- Вопрос задан более года назад
- 435 просмотров
4 комментария
Простой 4 комментария
I can’t import discord in python
sorry for bad english right at the beginning :(. I am very new to programming with Python. I just wanted to programm a bot for my Discord server. I watched a YouTube tutorial on how to set up a bot for a discord server and it just does not work how i try it ;-;. My problem is that i can’t import the discord-package. It should be done with the line import discord But it marks «discord» as an error because he can’t find it. I installed it in powershell with the command pip install discord I can also find the discord folder in localappdata by C:\Users\AppData\Local\Programs\Python\Python37\Lib\site-packages
asked Jul 16, 2020 at 0:18
27 1 1 gold badge 1 1 silver badge 2 2 bronze badges
what does python —version say?
Jul 16, 2020 at 0:19
Was the installation successful? What version of pip are you using? Do you have multiple python versions installed?
Saved searches
Use saved searches to filter your results more quickly
Cancel Create saved search
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
An API wrapper for Discord written in Python.
License
Rapptz/discord.py
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch branches/tags
Branches Tags
Could not load branches
Nothing to show
Could not load tags
Nothing to show
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Cancel Create
- Local
- Codespaces
HTTPS GitHub CLI
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
a5d03d4 Oct 25, 2023
Git stats
Files
Failed to load latest commit information.
Latest commit message
Commit time
July 1, 2023 18:26
October 25, 2023 19:28
October 25, 2023 19:28
September 16, 2023 20:32
September 30, 2023 14:28
April 28, 2022 20:47
May 28, 2023 07:04
January 15, 2021 05:28
August 22, 2021 02:25
August 20, 2022 11:58
August 20, 2022 11:58
April 2, 2022 11:38
October 24, 2023 16:07
October 1, 2023 02:55
README.rst
A modern, easy to use, feature-rich, and async ready API wrapper for Discord written in Python.
- Modern Pythonic API using async and await .
- Proper rate limit handling.
- Optimised in both speed and memory.
Python 3.8 or higher is required
To install the library without full voice support, you can just run the following command:
# Linux/macOS python3 -m pip install -U discord.py # Windows py -3 -m pip install -U discord.py
Otherwise to get voice support you should run the following command:
# Linux/macOS python3 -m pip install -U "discord.py[voice]" # Windows py -3 -m pip install -U discord.py[voice]
To install the development version, do the following:
$ git clone https://github.com/Rapptz/discord.py $ cd discord.py $ python3 -m pip install -U .[voice]
- PyNaCl (for voice support)
Please note that when installing voice support on Linux, you must install the following packages via your favourite package manager (e.g. apt , dnf , etc) before running the above commands:
- libffi-dev (or libffi-devel on some systems)
- python-dev (e.g. python3.8-dev for Python 3.8)
import discord class MyClient(discord.Client): async def on_ready(self): print('Logged on as', self.user) async def on_message(self, message): # don't respond to ourselves if message.author == self.user: return if message.content == 'ping': await message.channel.send('pong') intents = discord.Intents.default() intents.message_content = True client = MyClient(intents=intents) client.run('token')
import discord from discord.ext import commands intents = discord.Intents.default() intents.message_content = True bot = commands.Bot(command_prefix='>', intents=intents) @bot.command() async def ping(ctx): await ctx.send('pong') bot.run('token')
You can find more examples in the examples directory.
- Documentation
- Official Discord Server
- Discord API
