24 Commits
Author SHA1 Message Date
ryslandevds 66f002d620 Update config.py 2024-01-13 13:08:24 +03:00
ryslandevds 431b50d053 Update main.py 2024-01-13 13:08:07 +03:00
ryslandevds 98d9788ebc Update user_ids.json 2024-01-13 13:07:44 +03:00
chydo 14418139cb added types to user in config.py 2023-11-03 23:17:16 +07:00
chydo 4d562950cf some updates 2023-11-03 23:07:48 +07:00
chydo 8a96e672f3 many fixes 2023-11-02 00:46:47 +07:00
chydo a882198ec2 many fixes 2023-11-02 00:34:55 +07:00
chydo eef67f0c4d fix 2023-11-01 23:25:20 +07:00
chydo fae7c43a3e Squashed commit of the following:
commit 470172e43f
Author: dize_dev <destersamp@gmail.com>
Date:   Wed Nov 1 18:09:56 2023 +0600

    Обновление v0.5.3

commit 7c74c7364d
Merge: 9c691d8 8bf604b
Author: dize_dev <destersamp@gmail.com>
Date:   Tue Oct 31 23:36:23 2023 +0600

    Merge remote-tracking branch 'github/master' into dize

    # Conflicts:
    #	config.py
    #	routes/__init__.py
    #	routes/delete_msg.py
    #	routes/info_bot.py
    #	routes/rewards.py

commit 9c691d8bf0
Author: dize_dev <destersamp@gmail.com>
Date:   Tue Oct 31 22:11:13 2023 +0600

    Обновление v0.5.2

commit 9a0f019eeb
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 23:58:24 2023 +0600

    Обновление v0.5.1
    Edit code

commit a4d1a3b690
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 23:53:40 2023 +0600

    Обновление v0.5
    Добавлена команда Пинг,
    Обнавлена команда Бот,
    Исправлены ошибки.

commit 2880f2889d
Merge: 20d1b08 5ed0d2f
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 21:54:06 2023 +0600

    Merge remote-tracking branch 'github/dize' into dize

commit 20d1b08344
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 21:52:46 2023 +0600

    fixed bug

commit 31e7bfce6f
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 21:51:11 2023 +0600

    fixed bug

commit 972b8e94d7
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 21:50:47 2023 +0600

    fixed bug

commit 5ed0d2f53d
Author: /dize <87265715+dizedev@users.noreply.github.com>
Date:   Mon Oct 30 19:03:23 2023 +0600

    Update config.py

commit 13238d5139
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:40:06 2023 +0600

    edit

commit 4c99f4042a
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:38:30 2023 +0600

    Обновление: v0.4

commit 0368bc75eb
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:37:31 2023 +0600

    Обновление: v0.3

commit 4091e409b5
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:35:36 2023 +0600

    Обновление: v0.3

commit 5beb9d01bc
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:28:18 2023 +0600

    Обновление: v0.3

commit 11c2e8c16e
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:26:34 2023 +0600

    Обновление: v0.3

commit 4c62f4a920
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:25:17 2023 +0600

    Обновление: v0.3

commit 7cf41c6bc3
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:18:55 2023 +0600

    Обновление: v0.1

commit 6019f6a287
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:16:29 2023 +0600

    Обновление: v0.2

commit f96505a675
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 18:05:42 2023 +0600

    Обновление: v0.2

commit bf61685d8e
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 17:53:33 2023 +0600

    Обновление: v0.2

commit b6082e3778
Author: dize_dev <destersamp@gmail.com>
Date:   Mon Oct 30 17:50:32 2023 +0600

    Обновление: v0.2
2023-11-01 23:16:19 +07:00
chydo 909eb356b0 edit achievements 2023-11-01 11:46:44 +07:00
chydo c72ee83068 Merge remote-tracking branch 'origin/master' 2023-11-01 11:10:33 +07:00
chydo cae2de9c41 remove reaction on "все" 2023-11-01 11:10:23 +07:00
chydo 88fafdeea2 Delete venv directory 2023-11-01 11:03:24 +07:00
chydo 8bf604b8bc Merge pull request #3 from dizedev/feature/sqlalchemy
added sqlalchemy
2023-10-31 23:35:37 +07:00
chydo 97afd9c257 Delete .idea directory 2023-10-31 23:34:49 +07:00
chydo 665e9b804d what it? 2023-10-31 23:34:25 +07:00
chydo aed9ef0664 coolest edit's 2023-10-31 23:34:08 +07:00
chydo c5f744fe46 edit .gitignore 2023-10-30 23:30:54 +07:00
chydo 57f401ee5f code reformat 2023-10-30 23:30:16 +07:00
chydo ce88bb6dc8 more cool features 2023-10-30 23:27:40 +07:00
chydo 27bd2780da Merge pull request #2 from dizedev/feature/add_git_version
make it more cool
2023-10-30 23:01:48 +07:00
chydo 7774f08180 make it more cool 2023-10-30 23:00:56 +07:00
chydo 0622024bec Squashed commit of the following:
commit 49f8a7c8cb
Author: /dize <87265715+dizedev@users.noreply.github.com>
Date:   Mon Oct 30 19:03:08 2023 +0600

    Update config.py

commit e509aa34fd
Author: Alex <me@chydo.dev>
Date:   Mon Oct 30 00:53:25 2023 +0700

    added requirements

commit 19eae811ab
Author: Alex <me@chydo.dev>
Date:   Mon Oct 30 00:50:56 2023 +0700

    some fixes//

commit e35a687991
Author: Alex <me@chydo.dev>
Date:   Mon Oct 30 00:46:41 2023 +0700

    some edits
2023-10-30 22:44:32 +07:00
/dize 3465160c3a Update config.py 2023-10-30 19:02:30 +06:00
28 changed files with 621 additions and 127 deletions
+255
View File
@@ -0,0 +1,255 @@
### VisualStudioCode template
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/
### PyCharm+all template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
-3
View File
@@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
-10
View File
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="ASK" />
<option name="description" value="" />
</component>
</project>
-6
View File
@@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (UserVKBot)" project-jdk-type="Python SDK" />
</project>
-8
View File
@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/UserVKBot.iml" filepath="$PROJECT_DIR$/.idea/UserVKBot.iml" />
</modules>
</component>
</project>
Generated
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+12 -9
View File
@@ -1,14 +1,17 @@
from vkbottle.user import UserLabeler, Message, User
TOKEN = 'vk1.a.4nNdLuOJin9tn71J-cKGu6MKCR2rNHkdRPn4lbW28CS9aL0Q-rhG3ZQi6UQnV9ClpBrNp2obRUltWREoSuwz2Km7OXGlBaP3jt9KsEeut4N3OvHWoTUuqNEtiRrgz2koSrPXLEJZ8i974KD2CgXWqmX4IsSC3kCMDK_aS1xetU3S38-Z1JFyNZu5Tl8yUGopptCjEqA9jF8CjznWv1gC2A'
bl = UserLabeler()
user = User(token=TOKEN)
import vkbottle
from vkbottle.user import Message
import typing
TOKEN = "test"
prefix_bot = "хуй"
prefix_dd = "дд"
user: typing.Optional[vkbottle.User] = None
DB_LOGIN = ""
DB_PASSWORD = ""
DB_HOST = ""
DB_NAME = ""
async def edit_message(
message: Message,
@@ -23,5 +26,5 @@ async def edit_message(
kwargs.setdefault('dont_parse_links', False)
return await user.api.messages.edit(
**kwargs
**kwargs
)
+13 -14
View File
@@ -1,23 +1,22 @@
from vkbottle.dispatch.rules import ABCRule
from vkbottle.user import Message
import json
from vkbottle.dispatch.rules import ABCRule
from vkbottle.user import Message
def load_trusted_ids():
try:
with open("./user_ids.json", "r") as json_file:
data = json.load(json_file)
return data
except FileNotFoundError:
# Если файл не существует, вернуть пустой список
return []
class Permission(ABCRule[Message]):
def __init__(self):
self.trusted_ids = self.load_trusted_ids()
def load_trusted_ids(self):
try:
with open("./user_ids.json", "r") as json_file:
data = json.load(json_file)
return data
except FileNotFoundError:
# Если файл не существует, вернуть пустой список
return []
self.trusted_ids = load_trusted_ids()
async def check(self, event: Message) -> bool:
return event.from_id in self.trusted_ids
+1
View File
@@ -0,0 +1 @@
from . import config, models, requests
+7
View File
@@ -0,0 +1,7 @@
from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine
import config
DB_CONNECT_URL = f"postgresql+asyncpg://{config.DB_LOGIN}:{config.DB_PASSWORD}@{config.DB_HOST}/{config.DB_NAME}"
engine = create_async_engine(DB_CONNECT_URL)
async_session = async_sessionmaker(engine)
+30
View File
@@ -0,0 +1,30 @@
from sqlalchemy import (BigInteger, Column, Identity, Text, JSON, TIMESTAMP)
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
pass
class UsersTokens(Base):
__tablename__ = "users_tokens"
id = Column("id", BigInteger, Identity(start=1, increment=1, minvalue=1, cycle=False, cache=1), nullable=False,
primary_key=True)
vkid = Column("vkid", BigInteger, nullable=False, unique=True)
token = Column("token", Text, nullable=False)
class UsersProfile(Base):
__tablename__ = "users_profile"
# TODO: think about foreign_id
id = Column("id", BigInteger, Identity(start=1, increment=1, minvalue=1, cycle=False, cache=1), nullable=False,
primary_key=True)
vkid = Column("vkid", BigInteger, nullable=False, unique=True)
achievements = Column("achievements", JSON)
trusted_ids = Column("trusted_ids", JSON)
prefix = Column("prefix", Text)
prefix_d = Column("prefix_d", Text)
prefix_delete = Column("prefix_delete", Text)
last_login = Column("last_login", TIMESTAMP)
+54
View File
@@ -0,0 +1,54 @@
from typing import Optional
from loguru import logger
from sqlalchemy import select
import db
async def execute_statement(statement) -> None:
"""
Возвращает результат выполнения statement
:param statement:
:return:
"""
try:
async with db.config.async_session() as session:
await session.execute(statement)
await session.commit()
except Exception as e:
logger.exception(e)
# return None
async def get_user_token(user_id: int) -> Optional[db.models.UsersTokens]:
"""
Возвращает токен пользователя
:param user_id: VKID
"""
try:
async with db.config.async_session() as session:
result = await session.execute(select(db.models.UsersTokens).where(db.models.UsersTokens.vkid == user_id))
return result.scalars().one_or_none()
except Exception as e:
logger.exception(e)
return None
async def get_user_profile(user_id: int) -> Optional[db.models.UsersProfile]:
"""
Получает профиль пользователя
:param user_id: VKID
"""
try:
async with db.config.async_session() as session:
result = await session.execute(select(db.models.UsersProfile).where(db.models.UsersProfile.vkid == user_id))
return result.scalars().one_or_none()
except Exception as e:
logger.exception(e)
return None
+25 -5
View File
@@ -1,12 +1,32 @@
import asyncio
import sys
from config import user
from routes import labelers
from loguru import logger
from vkbottle.user import User
import config
import db
logger.add(sys.stderr, format="{time} {level} {message}", filter="my_module", level="INFO")
for custom_labeler in labelers:
user.labeler.load(custom_labeler)
async def main():
from routes import labelers
user_info = await db.requests.get_user_token()
if not user_info:
logger.error("user don't have a token in db!")
return
config.user = User(token=user_info.token)
for custom_labeler in labelers:
config.user.labeler.load(custom_labeler)
loop.create_task(config.user.run_polling())
if __name__ == "__main__":
user.run_forever()
loop = asyncio.get_event_loop()
loop.create_task(main())
loop.run_forever()
+6
View File
@@ -0,0 +1,6 @@
gitpython==3.1.40
loguru==0.7.2
pytz==2023.3.post1
vkbottle==4.3.12
SQLAlchemy~=2.0.22
asyncpg
+2 -2
View File
@@ -1,3 +1,3 @@
from . import game_handler, deletedmsg, info_bot, rewards
from . import game_handler, delete_msg, info_bot, rewards, ping, profile, add_friend, not_command
labelers = [game_handler.bl, deletedmsg.bl, info_bot.bl, rewards.bl]
labelers = [game_handler.bl, delete_msg.bl, info_bot.bl, rewards.bl, ping.bl, profile.bl, add_friend.bl, not_command.bl]
+56
View File
@@ -0,0 +1,56 @@
from vkbottle import VKAPIError
from vkbottle.user import Message, UserLabeler
from config import edit_message, prefix_bot, user
from custom_rules.permission import Permission
bl = UserLabeler()
@bl.message(Permission(), text=[prefix_bot + " +др"])
async def add_to_friends_cmd(ctx: Message):
if not ctx.reply_message:
await ctx.answer("❗ Ошибка при выполнении, необходимо пересланное сообщение")
return
friend_id = ctx.reply_message.from_id
try:
await user.api.friends.add(user_id=friend_id)
await edit_message(ctx, "✅ Все отлично, запрос отправлен")
except Exception as e:
if VKAPIError[174]:
await edit_message(ctx, "❗ Невозможно добавить в друзья самого себя")
elif VKAPIError[175]:
await edit_message(ctx,
"❗ Невозможно добавить в друзья пользователя, который занес Вас в свой черный список")
elif VKAPIError[176]:
await edit_message(ctx,
"❗ Невозможно добавить в друзья пользователя, который занесен в Ваш черный список")
else:
await edit_message(ctx, f"❗ Невозможно добавить в друзья пользователя: {e.message}")
@bl.message(Permission(), text=[prefix_bot + " -др"])
async def remove_from_friends_cmd(ctx: Message):
if not ctx.reply_message:
await edit_message(ctx, "❗ Ошибка при выполнении, необходимо пересланное сообщение")
return
friend_id = ctx.reply_message.from_id
response = await user.api.friends.delete(user_id=friend_id)
if not response.success:
await edit_message(ctx, "❗ Произошла ошибка при удалении друга")
return
if response.friend_deleted:
await edit_message(ctx, "✅ Друг удален")
elif response.out_request_deleted:
await edit_message(ctx, "✅ Отменена исходящая заявка")
elif response.in_request_deleted:
await edit_message(ctx, "✅ Отклонена входящая заявка")
elif response.suggestion_deleted:
await edit_message(ctx, "✅ Отклонена рекомендация друга")
else:
await edit_message(ctx, "❗ Произошла ошибка")
+25 -21
View File
@@ -1,8 +1,11 @@
import datetime
from custom_rules.permission import Permission
from vkbottle.user import Message
from config import bl, user, prefix_dd
from vkbottle.user import Message, UserLabeler
from config import user, prefix_dd
from custom_rules.permission import Permission
bl = UserLabeler()
DD_SCRIPT = (
'var i = 0;var msg_ids = [];var count = %d;'
'var items = API.messages.getHistory({"peer_id":%d,"count":"200", "offset":"0"}).items;'
@@ -16,31 +19,32 @@ DD_SCRIPT = (
@bl.message(
Permission(),
text=[prefix_dd + " <count:int>"],
Permission(),
text=[prefix_dd + " <count:int>"],
)
async def dd_handler(message: Message, count: int = 2):
async def dd_cmd(ctx: Message, count: int = 2):
await user.api.execute(
DD_SCRIPT % (
count,
message.peer_id,
message.from_id,
int(datetime.datetime.now().timestamp())
)
DD_SCRIPT % (
count,
ctx.peer_id,
ctx.from_id,
int(datetime.datetime.now().timestamp())
)
)
@bl.message(
Permission(),
text=["все", "всё"],
Permission(),
text=[prefix_dd + " все", prefix_dd + " всё"],
)
async def dd_all_handler(message: Message):
async def dd_all_cmd(ctx: Message):
count = 1000
await user.api.execute(
DD_SCRIPT % (
count,
message.peer_id,
message.from_id,
int(datetime.datetime.now().timestamp())
)
DD_SCRIPT % (
count,
ctx.peer_id,
ctx.from_id,
int(datetime.datetime.now().timestamp())
)
)
+10 -6
View File
@@ -1,14 +1,18 @@
import asyncio
from vkbottle.user import Message
from config import bl, prefix_bot, edit_message
from vkbottle.user import Message, UserLabeler
from config import prefix_bot, edit_message
from custom_rules.permission import Permission
bl = UserLabeler()
@bl.message(
Permission(),
text=[prefix_bot + " игра"],
Permission(),
text=[prefix_bot + " игра"],
)
async def game(message: Message):
async def game_cmd(ctx: Message):
loader = (
'⬜⬜⬜⬜⬜⬜⬜⬜⬛⬛⬜⬜⬜⬜⬜⬜⬜',
"""
@@ -81,5 +85,5 @@ async def game(message: Message):
)
for new_text in loader:
await edit_message(message, new_text)
await edit_message(ctx, new_text)
await asyncio.sleep(1)
+15 -7
View File
@@ -1,11 +1,19 @@
from custom_rules.permission import Permission
from vkbottle.user import Message
from config import bl, edit_message, prefix_bot
from utils import rewards_list
import git
import pytz
from vkbottle.user import Message, UserLabeler
from config import edit_message, prefix_bot
from custom_rules.permission import Permission
bl = UserLabeler()
@bl.message(Permission(), text=[prefix_bot + " бот"])
async def about(message: Message):
await edit_message(message,
"Информация о боте 🤖:\n\n Название бота 🤖: dize_lp\n Версия бота ⚙️: v0.1\n Создатель бота 👨‍🦱: @dize_dev(Илдырым Денница)\n Достижения🏆: " + rewards_list[1])
async def about_cmd(ctx: Message):
repo = git.Repo(search_parent_directories=True)
version = repo.head.object.hexsha[:7]
version_date = repo.head.object.committed_datetime.astimezone(pytz.timezone("Europe/Moscow"))
# TODO: use Pillow to create img in real-time
await edit_message(ctx, attachment="photo-202995525_457239051")
+11
View File
@@ -0,0 +1,11 @@
from vkbottle.user import Message, UserLabeler
from config import edit_message, prefix_bot
from custom_rules.permission import Permission
bl = UserLabeler()
@bl.message(Permission(), text=prefix_bot + " <command>")
async def wrapper(message: Message, command):
await edit_message(message, "Такой команды не существует")
+15
View File
@@ -0,0 +1,15 @@
from vkbottle.user import Message, UserLabeler
import utils
from config import edit_message, prefix_bot
from custom_rules.permission import Permission
bl = UserLabeler()
@bl.message(Permission(), text=[prefix_bot + " пинг"])
async def ping_cmd(ctx: Message):
await edit_message(
ctx,
await utils.ping(ctx, "ПОНГ")
)
+28
View File
@@ -0,0 +1,28 @@
import git
from vkbottle.user import Message, UserLabeler
import db.requests
from config import edit_message, prefix_bot, prefix_dd
from custom_rules.permission import Permission
bl = UserLabeler()
@bl.message(Permission(), text=[prefix_bot + " профиль"])
async def get_profile_cmd(ctx: Message):
repo = git.Repo(search_parent_directories=True)
version = repo.head.object.hexsha[:7]
info = await db.requests.get_user_profile(user_id=ctx.from_id)
await edit_message(ctx,
f"[ Impulse LP ]\n"
f"Текущая версия: {version}\n"
f"Основной префикс: {info.prefix}\n"
f"Префикс дд: {info.prefix_delete}\n"
f"{info.prefix_d}\n"
f"\nДостижения\n"
f"{info.achievements}\n"
f"Последний вход на сайт: {info.last_login}\n"
f"Довы:\n"
f"{info.trusted_ids}"
)
+31 -8
View File
@@ -1,13 +1,36 @@
from vkbottle.user import Message, UserLabeler
import db
import utils
from config import edit_message, prefix_bot
from custom_rules.permission import Permission
from vkbottle.user import Message
from config import bl, edit_message, prefix_bot
from utils import rewards_list
listToStr = ' '.join(map(str, rewards_list))
bl = UserLabeler()
@bl.message(Permission(), text=[prefix_bot + " достижения"])
async def rewards(message: Message):
await edit_message(message,
"Вот список всех достижений 🏆:\n " + listToStr)
async def rewards_cmd(ctx: Message):
text = "Список всех достижений:\n\n"
have_ = ""
dont_have = ""
info = await db.requests.get_user_profile(user_id=ctx.from_id)
# TODO: CHECK BEFORE DEPLOY!!
# TODO: create table in db
# TODO: fill items in models.py
for item in info.achievements:
if item in utils.rewards.keys():
have_ += f"{utils.rewards[item]}\n"
else:
dont_have += f"{utils.rewards[item]}\n"
if have_ != "":
text += "Открытые:\n"
text += have_
if dont_have != "":
text += "Неоткрытые:\n"
text += dont_have
await edit_message(ctx, text)
+1 -1
View File
@@ -1 +1 @@
[368658177, 304398797]
[]
+24 -8
View File
@@ -1,8 +1,24 @@
rewards_list = [
"Первооткрыватель 🎓\n",
"Создатель ⭐\n",
"Администратор 👨🏻‍💼\n",
"Модератоор 🛡️\n",
"Иследователь 🔎\n",
"Спонсор 💸\n",
]
import time
from vkbottle.user import Message
rewards = {
"discoverer": "Первооткрыватель",
"creator": "Создатель",
"admin": "Администратор",
"moderator": "Moderator",
"researcher": "Исследователь",
"sponsor": "Спонсор"
}
next_line_symbol = "\n"
async def ping(message: Message, answer: str) -> str:
delta = round(time.time() - message.date, 2)
if delta < 0:
delta = "666"
return f"{answer} Модуль Impulse LP\n" \
f"Ответ через {delta} с"
-2
View File
@@ -1,2 +0,0 @@
# created by virtualenv automatically
*