Replies: 1 comment
-
Hi! You seem to be on the wrong repository. The correct one would be Disnake at https://github.com/DisnakeDev/disnake. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
import disnake
from disnake.ext import commands
from disnake.ext.commands import bot
disnake.ext.commands.when_mentioned
intents = disnake.Intents.default()
intents.members = True
intents.message_contents = True
words = ["яблоко", "груша", "апельсин", "персик", "слива"]
bot = commands.Bot(command_prefix = '!', test_guilds=[1202637937150267522],intents=disnake.Intents.default())
@bot.event
async def on_ready():
print(f'Logged in as {0.user}'.format(bot))
@bot.command()
async def load_data():
try:
with open("data.json", "r", encoding="utf-8") as file:
return json.load(file)
except FileNotFoundError:
return {}
data = load_data()
async def check_word(guess, target):
result = []
for i in range(5):
if guess[i] == target[i]:
result.append('') # Зеленый
elif guess[i] in target:
result.append('') # Желтый
else:
result.append('') # Красный
return ''.join(result)
async def guess(ctx, word: str):
user_id = ctx.author.id
if user_id not in data:
data[user_id] = {"points": 0, "attempts": 0}
async def score(ctx):
user_id = ctx.author.id
user_points = data.get(user_id, {}).get("points", 0)
await ctx.send(f"Ваши очки: {user_points}")
async def leaderboard(ctx):
leaderboard = sorted(data.items(), key=lambda x: x[1]['points'], reverse=True)[:30]
msg = " Лидеры:\n"
for idx, (user_id, info) in enumerate(leaderboard):
user = await bot.fetch_user(userid)
msg += f"{idx + 1}. {user.name} - {info['points']} очков\n"
await ctx.send(msg)
bot.run ('MTQwNTA0NjMyNjgzNTgwNjI0OA.GrfLB4.Dq03j6mrmvimJNoFh2A6Ak65eesEE-FtddhVCc')
intents.message_contents = True
^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Intents' object has no attribute 'message_contents' and no dict for setting new attributes. Did you mean: 'message_content'?
Process finished with exit code 1
Beta Was this translation helpful? Give feedback.
All reactions