Files
userbot/userbot/modules/dice.py
T
forust 0506aaaac8 chore(userbot): apply ruff check --fix and ruff format
- ruff check --fix: 210 auto-fixed errors (import sorting, trailing
  whitespace, unused imports, f-string fixups, deprecated annotations)
- ruff format: 104 files reformatted to consistent style
- 268 non-auto-fixable issues remain (S113 requests timeout, etc.)
2026-06-19 12:19:01 +02:00

27 lines
974 B
Python

import asyncio
from pyrogram import Client, enums, filters
from pyrogram.types import Message
from utils.misc import modules_help, prefix
from utils.scripts import format_exc
@Client.on_message(filters.command('dice', prefix) & filters.me)
async def dice_text(client: Client, message: Message):
try:
value = int(message.command[1])
if value not in range(1, 7):
raise AssertionError
except (ValueError, IndexError, AssertionError):
return await message.edit('<b>Invalid value</b>', parse_mode=enums.ParseMode.HTML)
try:
message.dice = type('bruh', (), {'value': 0})()
while message.dice.value != value:
message = (await asyncio.gather(message.delete(), client.send_dice(message.chat.id)))[1]
except Exception as e:
await message.edit(format_exc(e), parse_mode=enums.ParseMode.HTML)
modules_help['dice'] = {'dice [1-6]*': 'Generate dice with specified value. Works only in groups'}