class Main(QtWidgets.QWidget, Ui_Form):
def __init__(self, parent=None):
super(Main, self).__init__(parent)
self.setupUi(self)
self.w = self.size().width() # "определение ширины"
self.h = self.size().height() # "определение высоты"
await ctx.channel.purge(limit=count + 1)
import datetime
total_time = datetime.timedelta()
lst = ["00:33:33", "00:23:34", "01:32:21"]
for time in lst:
hours, minutes, seconds = time.split(":")
hours, minutes, seconds = int(hours), int(minutes), int(seconds)
total_time += datetime.timedelta(hours=hours, minutes=minutes, seconds=seconds)
print(total_time)
def midel(numbers):
numbers = [int(number) for number in numbers]
return sum(numbers) / len(numbers)
numbers = input("Введите цифры через пробел: ")
numbers = numbers.split(" ")
result = midel(numbers)
print(f"Результат: {result}")
Введите цифры через пробел: 2 2 2 2
Результат: 2.0
def command(**kwargs):
def wrapper(func_ref):
func_ref.command_kwargs = kwargs
return func_ref
return wrapper
class Aliases:
def __init__(self, bot: Bot):
self.bot = bot
@property
def commands(self) -> tuple:
return (
self.new_alias,
)
@command(
name="новый алиас",
args={"алиас": "str"}
)
def new_alias(self, message: types.Message = None):
...
def setup(bot: Bot, dp: Dispatcher):
aliases = Aliases(bot)
for function in aliases.commands:
print(function, function.command_kwargs)
<\bound method Aliases.new_alias of <\aliases.py.Aliases object at 0x7f4b0d0c2560>> {'name': 'новый алиас', 'args': {'алиас': 'str'}}
if collection.find_one({'id' : message.chat.id) is None: # Если нету юзера в БД
...
@bot.event
async def on_message(message):
if "привет" in str(message).lower():
await message.channel.send("Привет, друг")
@bot.event
async def on_message(message):
if "привет" in str(message.content).lower():
await message.channel.send("Привет, друг")
$cd C:\Users\nkikd\Desktop\explorer
$pyinstaller --distpath=C:\Users\nkikd\Desktop\explorer --onefile main.py