-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Отчет о продажах доступен для администратора
- Loading branch information
1 parent
607fe35
commit a9602ad
Showing
74 changed files
with
13,284 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# - *- coding: utf- 8 - *- | ||
import os | ||
import sys | ||
|
||
import colorama | ||
from aiogram import executor, Dispatcher | ||
from colorama import Fore | ||
|
||
|
||
from tgbot.data.config import get_admins | ||
from tgbot.handlers import dp | ||
from tgbot.loader import scheduler | ||
from tgbot.middlewares import setup_middlewares | ||
from tgbot.services.api_session import RequestsSession | ||
from tgbot.services.api_sqlite import create_dbx | ||
from tgbot.services.regular import send_message_start | ||
from tgbot.utils.misc.bot_commands import set_commands | ||
from tgbot.utils.misc.bot_logging import bot_logger | ||
from tgbot.utils.misc_functions import check_update, check_bot_data, on_startup_notify, update_profit_day, \ | ||
update_profit_week | ||
|
||
#CHANNEL_ID = '-1001683374540' | ||
#text = "test" | ||
|
||
#async def send_message(channel_id: int, text: str): | ||
# await bot.send_message(channel_id, text) | ||
|
||
# Запуск шедулеров | ||
async def scheduler_start(): | ||
# scheduler.add_job(send_message_start, 'interval', seconds=600) | ||
# scheduler.add_job(check_order_messages, 'interval', seconds=600) | ||
# scheduler.add_job(update_profit_week, "cron", day_of_week="mon", hour=00, minute=1) | ||
# scheduler.add_job(update_profit_day, "cron", hour=00) | ||
# scheduler.add_job(check_update, "cron", hour=00) | ||
pass | ||
|
||
# Выполнение функции после запуска бота | ||
async def on_startup(dp: Dispatcher): | ||
await dp.bot.delete_webhook() | ||
await dp.bot.get_updates(offset=-1) | ||
dp.bot['rSession'] = RequestsSession() | ||
|
||
await set_commands(dp) | ||
await check_bot_data() | ||
await scheduler_start() | ||
await on_startup_notify(dp) | ||
|
||
bot_logger.exception("BOT WAS STARTED") | ||
print(Fore.LIGHTYELLOW_EX + "~~~~~ Bot was started ~~~~~") | ||
print(Fore.LIGHTBLUE_EX + "~~~~~ TG developer: @raclear ~~~~~") | ||
print(Fore.RESET) | ||
|
||
if len(get_admins()) == 0: print("***** ENTER ADMIN ID IN settings.ini *****") | ||
|
||
|
||
# Выполнение функции после выключения бота | ||
async def on_shutdown(dp: Dispatcher): | ||
rSession: RequestsSession = dp.bot['rSession'] | ||
await rSession.close() | ||
# | ||
await dp.storage.close() | ||
await dp.storage.wait_closed() | ||
await (await dp.bot.get_session()).close() | ||
# | ||
if sys.platform.startswith("win"): | ||
os.system("cls") | ||
else: | ||
os.system("clear") | ||
|
||
|
||
if __name__ == "__main__": | ||
create_dbx() | ||
|
||
scheduler.start() | ||
setup_middlewares(dp) | ||
|
||
executor.start_polling(dp, on_startup=on_startup, on_shutdown=on_shutdown) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
cd autoshopDjimbo3.1&&python3.9 main.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
aiogram | ||
colorlog | ||
requests | ||
bs4 | ||
beautifulsoup4 | ||
pyQiwiP2P | ||
aiohttp | ||
APScheduler==3.9.1 | ||
colorama | ||
async_class | ||
yoomoney | ||
geopy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# - *- coding: utf- 8 - *- | ||
[settings] | ||
token= | ||
admin_id= | ||
admin = | ||
shopadmin_id= | ||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
# - *- coding: utf- 8 - *- | ||
import sqlite3 | ||
import configparser | ||
import json | ||
|
||
|
||
read_config = configparser.ConfigParser() | ||
read_config.read('settings.ini') | ||
|
||
BOT_TOKEN = read_config['settings']['token'].strip() # Токен бота | ||
PATH_DATABASE = 'tgbot/data/database.db' # Путь к БД | ||
PATH_LOGS = 'tgbot/data/logs.log' # Путь к Логам | ||
BOT_VERSION = '1.0' | ||
|
||
# Преобразование полученного списка в словарь | ||
|
||
|
||
def dict_factory(cursor, row): | ||
save_dict = {} | ||
|
||
for idx, col in enumerate(cursor.description): | ||
save_dict[col[0]] = row[idx] | ||
|
||
return save_dict | ||
|
||
# Форматирование запроса без аргументов | ||
|
||
|
||
def update_format(sql, parameters: dict): | ||
if "XXX" not in sql: | ||
sql += " XXX " | ||
|
||
values = ", ".join([ | ||
f"{item} = ?" for item in parameters | ||
]) | ||
sql = sql.replace("XXX", values) | ||
|
||
return sql, list(parameters.values()) | ||
|
||
|
||
def get_type_trade(): | ||
get_type_trade = get_settingsx()['type_trade'] | ||
return get_type_trade | ||
|
||
# Получение администраторов бота | ||
|
||
|
||
def get_admins(): | ||
read_admins = configparser.ConfigParser() | ||
read_admins.read('settings.ini') | ||
|
||
admins = read_admins['settings']['admin_id'].strip() | ||
admins = admins.replace(' ', '') | ||
|
||
if ',' in admins: | ||
admins = admins.split(',') | ||
else: | ||
if len(admins) >= 1: | ||
admins = [admins] | ||
else: | ||
admins = [] | ||
|
||
while '' in admins: | ||
admins.remove('') | ||
while ' ' in admins: | ||
admins.remove(' ') | ||
while '\r' in admins: | ||
admins.remove('\r') | ||
|
||
admins = list(map(int, admins)) | ||
# print(admins) | ||
return admins | ||
|
||
# Получение админов магазинов | ||
|
||
|
||
def get_shopadmins(): | ||
with sqlite3.connect(PATH_DATABASE) as con: | ||
con.row_factory = dict_factory | ||
sql = f"SELECT user_id FROM storage_users WHERE user_role='ShopAdmin'" | ||
allshopadmins = con.execute(sql).fetchall() | ||
# print(allshopadmins) | ||
shopadmins = [] | ||
for admin in allshopadmins: | ||
k = admin['user_id'] | ||
shopadmins.append(k) | ||
# print(shopadmins) | ||
# print(type(shopadmins)) | ||
|
||
return shopadmins | ||
|
||
|
||
def get_shopadmins2(): | ||
read_shopadmins = configparser.ConfigParser() | ||
read_shopadmins.read('settings.ini') | ||
|
||
shopadmins = read_shopadmins['settings']['shopadmin_id'].strip() | ||
shopadmins = shopadmins.replace(' ', '') | ||
|
||
if ',' in shopadmins: | ||
shopadmins = shopadmins.split(',') | ||
else: | ||
if len(shopadmins) >= 1: | ||
shopadmins = [shopadmins] | ||
else: | ||
shopadmins = [] | ||
|
||
while '' in shopadmins: | ||
shopadmins.remove('') | ||
while ' ' in shopadmins: | ||
shopadmins.remove(' ') | ||
while '\r' in shopadmins: | ||
shopadmins.remove('\r') | ||
|
||
shopadmins = list(map(int, shopadmins)) | ||
|
||
return shopadmins | ||
|
||
# Получение админов магазинов | ||
|
||
|
||
def is_shopadmin(user_id): | ||
with sqlite3.connect(PATH_DATABASE) as con: | ||
con.row_factory = dict_factory | ||
sql = f"SELECT user_id FROM storage_users " | ||
#sql, parameters = update_format(sql, kwargs) | ||
# parameters.append(user_id) | ||
shopadmin = con.execute( | ||
sql + "WHERE user_id = ?", [user_id]).fetchone() | ||
|
||
return shopadmin['user_id'] | ||
|
||
|
||
def check_adminproducts(): | ||
#get_position = get_positionsx(position_user_id=message.from_user.id) | ||
|
||
return 1 | ||
|
||
|
||
BOT_DESCRIPTION = f""" | ||
<b>❗🔴 Правила использования:</b> | ||
- Запрещено менять данные аккаунта, при этом вы можете добавлять друзей (для того чтоб поиграть с ними) | ||
- Запрещено использовать читы и другие виды мошенничества, играйте честно! | ||
- Вы не можете передавать аккаунт третьему лицу. Если это произойдет, то у нас будет зафиксирован вход с другого устройства. Вы будете деавторизованы и лишены возможности зайти в аккаунт, без возврата денежных средств. | ||
- На аккаунт может зайти наш оператор поддержки для проверки. При любых подозрениях, что аккаунтом кто-то пользуется кроме вас - сразу же сообщайте нам, мы проверим и деавторизуем любые сессии, кроме вашей. | ||
- После истечения срока аренды вы не можете продолжать пользоваться аккаунтом и должны выйти из аккаунта или же оплатить дополнительное время аренды. | ||
Активация предоставляется только на один компьютер. Вы платите за 1 активацию на 1 ПК! | ||
✅ Обязательно проверьте что ваш компьютер соответствует минимальным требованиям игры! | ||
✅ Мы не делаем возвратов если ваш ПК не соответствует минимальным требованиям игры. | ||
✅ Аккаунт куплен легально, является собственностью продавца и не передается вам в собственность. Менять пароль ЗАПРЕЩЕНО! Вы получаете только право использования аккаунта. | ||
➖➖➖➖➖➖➖➖➖➖ | ||
<b>⚜ Часто задаваемые вопросы:</b> | ||
➖➖➖➖➖➖➖➖➖➖ | ||
<b>Как взять игру в аренду ?</b> | ||
В главном меню бота выбираем - "Игры в аренду" => Игру которую хотите арендовать => Выбираете срок аренды => | ||
💰 Взять в аренду (Если на балансе недостаточно средств, пополнить баланс можно в профиле => "💰 Пополнить") | ||
<b>Как я получу игру после оплаты ?</b> | ||
Как только Вы оплатите аренду, доступы к аккаунту Steam появятся с Вашем профиле в разделе "🎁 Мои покупки" | ||
<b>Как мне начать играть ?</b> | ||
Вам выдаётся логин и пароль от аккаунта с игрой в Steam. | ||
Просто заходите в аккаунт с этими данными, на аккаунте будет арендованная игра. | ||
Срок аренды исчисляется с момента оплаты, устанавливаете и играете. | ||
<b>Не могу войти в Steam, что делать?</b> | ||
Если возникли сложности со входом, напишите нашему администратору - "@tech_steam" | ||
Ответ вы получите в порядке очереди обращения. | ||
<b>Могу ли я разместить свои игры в аренду в вашем магазине ?</b> | ||
По вопросам сотрудничества пишите - @ru_adm | ||
➖➖➖➖➖➖➖➖➖➖ | ||
<b>⚜ Контакты:</b> | ||
Техническая поддержка : @tech_steam | ||
Сотрудничество : @ru_adm | ||
➖➖➖➖➖➖➖➖➖➖ | ||
""".strip() |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
ERROR | 2022-12-04 16:30:14,219 | main.py:48 | BOT WAS STARTED | ||
NoneType: None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# - *- coding: utf- 8 - *- | ||
|
||
from .z_all_errors import dp | ||
from .main_start import dp | ||
from .admin_menu import dp | ||
from .user_menu import dp | ||
from .admin_functions import dp | ||
from .admin_payment import dp | ||
from .admin_products import dp | ||
from .admin_settings import dp | ||
from .user_transactions import dp | ||
from .user_location import dp | ||
from .admin_products_shop import dp | ||
from .z_all_missed_ import dp | ||
|
||
__all__ = ['dp'] |
Binary file added
BIN
+539 Bytes
TelegramGoodsinbot/tgbot/handlers/__pycache__/__init__.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+14.1 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/admin_functions.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+3.19 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/admin_menu.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+7.55 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/admin_payment.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+33.5 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/admin_products.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+10.1 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/admin_products_shop.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+5.7 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/admin_settings.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+4.1 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/main_start.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+4.23 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/user_location.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+56.8 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/user_menu.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+5.69 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/user_transactions.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+1.93 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/z_all_errors.cpython-310.pyc
Binary file not shown.
Binary file added
BIN
+1.45 KB
TelegramGoodsinbot/tgbot/handlers/__pycache__/z_all_missed_.cpython-310.pyc
Binary file not shown.
Oops, something went wrong.