forked from LinaProg/kts_project_template
-
Notifications
You must be signed in to change notification settings - Fork 0
New fitch4 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
olred
wants to merge
6
commits into
dev2
Choose a base branch
from
new_fitch4
base: dev2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
New fitch4 #5
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
aee56db
Добавил команду "Моя статистика!", в которой выводится кол-во побед ч…
olred f0485fb
Добавил тесты, еще не все.
olred 48bb188
Тесты + обработка событий
olred 3097496
Update READ_INSTRUCTION.txt
olred df651a3
Переделал после ревью
olred b475bd9
Delete vcs.xml
olred File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,63 @@ | ||
| """Add GameModel | ||
|
|
||
| Revision ID: e0fb8c912758 | ||
| Revises: | ||
| Create Date: 2023-03-04 19:24:14.714777 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| from sqlalchemy.dialects import postgresql | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = 'e0fb8c912758' | ||
| down_revision = None | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.create_table('game_session', | ||
| sa.Column('id', sa.BigInteger(), nullable=False), | ||
| sa.Column('chat_id', sa.BigInteger(), nullable=True), | ||
| sa.PrimaryKeyConstraint('id'), | ||
| sa.UniqueConstraint('chat_id') | ||
| ) | ||
| op.create_table('game', | ||
| sa.Column('id', sa.BigInteger(), nullable=False), | ||
| sa.Column('chat_id', sa.BigInteger(), nullable=True), | ||
| sa.Column('users', postgresql.JSONB(astext_type=sa.Text()), nullable=True), | ||
| sa.Column('state_photo', sa.Boolean(), nullable=True), | ||
| sa.Column('state_in_game', sa.Boolean(), nullable=True), | ||
| sa.Column('state_wait_votes', sa.Boolean(), nullable=True), | ||
| sa.Column('new_pair', postgresql.JSONB(astext_type=sa.Text()), nullable=True), | ||
| sa.Column('first_votes', sa.BigInteger(), nullable=True), | ||
| sa.Column('second_votes', sa.BigInteger(), nullable=True), | ||
| sa.Column('state_send_photo', sa.Boolean(), nullable=True), | ||
| sa.Column('voters', postgresql.JSONB(astext_type=sa.Text()), nullable=True), | ||
| sa.Column('amount_users', sa.BigInteger(), nullable=True), | ||
| sa.Column('last_winner', sa.Text(), nullable=True), | ||
| sa.ForeignKeyConstraint(['chat_id'], ['game_session.chat_id'], ondelete='CASCADE'), | ||
| sa.PrimaryKeyConstraint('id') | ||
| ) | ||
| op.create_table('participants', | ||
| sa.Column('id', sa.BigInteger(), nullable=False), | ||
| sa.Column('name', sa.Text(), nullable=False), | ||
| sa.Column('wins', sa.BigInteger(), nullable=True), | ||
| sa.Column('chat_id', sa.BigInteger(), nullable=True), | ||
| sa.Column('owner_id', sa.BigInteger(), nullable=True), | ||
| sa.Column('photo_id', sa.BigInteger(), nullable=True), | ||
| sa.Column('access_key', sa.Text(), nullable=True), | ||
| sa.ForeignKeyConstraint(['chat_id'], ['game_session.chat_id'], ondelete='CASCADE'), | ||
| sa.PrimaryKeyConstraint('id') | ||
| ) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_table('participants') | ||
| op.drop_table('game') | ||
| op.drop_table('game_session') | ||
| # ### end Alembic commands ### |
This file contains hidden or 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,28 @@ | ||
| """Add GameModel | ||
|
|
||
| Revision ID: eb47d650c4bf | ||
| Revises: e0fb8c912758 | ||
| Create Date: 2023-03-07 21:26:04.620744 | ||
|
|
||
| """ | ||
| from alembic import op | ||
| import sqlalchemy as sa | ||
| from sqlalchemy.dialects import postgresql | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = 'eb47d650c4bf' | ||
| down_revision = 'e0fb8c912758' | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.add_column('game', sa.Column('kicked_users', postgresql.JSONB(astext_type=sa.Text()), nullable=True)) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| op.drop_column('game', 'kicked_users') | ||
| # ### end Alembic commands ### |
This file contains hidden or 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,27 @@ | ||
| import asyncio | ||
|
|
||
| from app.store.bot.sender import VKSender | ||
| from app.store.vk_api.poller import Poller | ||
| from app.store.bot.manager import BotManager | ||
| from app.store import Store | ||
| from app.web.app import app | ||
|
|
||
|
|
||
| class Bot: | ||
| def __init__(self, n): | ||
| self.queue = asyncio.Queue() | ||
| self.out_queue = asyncio.Queue() | ||
| self.store = Store(app) | ||
| self.poller = Poller(self.queue, self.store) | ||
| self.worker = BotManager(self.queue, self.out_queue, app, n) | ||
| self.sender = VKSender(self.out_queue, app) | ||
|
|
||
| async def start(self): | ||
| await self.poller.start(app) | ||
| await self.worker.start() | ||
| await self.sender.start() | ||
|
|
||
| async def stop(self): | ||
| await self.poller.stop() | ||
| await self.worker.stop() | ||
| await self.sender.stop() |
This file contains hidden or 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
This file contains hidden or 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 @@ | ||
| 582423336 |
This file contains hidden or 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,18 @@ | ||
| import asyncio | ||
| import datetime | ||
|
|
||
|
|
||
| from app.bot_vk import Bot | ||
|
|
||
|
|
||
| def run(): | ||
| loop = asyncio.get_event_loop() | ||
| bot = Bot(3) | ||
| try: | ||
| print("Bot has been started") | ||
| loop.create_task(bot.start()) | ||
| loop.run_forever() | ||
| except KeyboardInterrupt: | ||
| print("\nstopping", datetime.datetime.now()) | ||
| loop.run_until_complete(bot.stop()) | ||
| print("Bot has been stopped", datetime.datetime.now()) | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,46 @@ | ||
| commands_for_users = { | ||
| "«Регистрация!»": "регистрирует всех участников игры.", | ||
| "«Загрузить фотографии!»": "после написания данной команды, скидываете фотографию, которая будет участвовать в конкурсе.", | ||
| "«Начать игру!»": "запускает игровой процесс.", | ||
| "«Остановить игру!»": "останавливает игровую сессию и выводит всех оставшихся участников.", | ||
| "«Моя статистика!»": "выводит персональную статистику человека.", | ||
| "«Последняя игра!»": "выводит информацию о последней игре.", | ||
| } | ||
|
|
||
| commands_for_admins = { | ||
| "«Стастика!»": "выводит статистику всех игроков.", | ||
| "«Замолчать!»": "запрещает выбранному участнику говорить.", | ||
| "«Говорить!»": "убирает у выбранного участника блокировку чата.", | ||
| "«Выгнать!»": "удаляет выбранного участника из чата.", | ||
| } | ||
|
|
||
|
|
||
| lexicon_for_messages = { | ||
| "DUR_GAME": "Данная команда недоступна во время игры!", | ||
| "NO_REG": "Вы не прошли регистрацию!", | ||
| "SUCC_REG": "Регистрация прошла успешно!", | ||
| "WINNER": "Победил", | ||
| "NO_WINNERS": "Никто не победил!", | ||
| "STATISTIC_PLAYER": "Статистика игрока", | ||
| "AMOUNT_WINS": "Кол-во побед", | ||
| "LAST_WINNER": "Последний победитель", | ||
| "NO_LAST_WINNER": "Игр еще не было или они закончились ничьей!", | ||
| "WELCOME_PHRASE": "Здравствуйте, я бот-викторина. Пожалуйста, для игры сделайте меня администратором!", | ||
| "SUCC_PHOTO": "Фотографии успешно загружены!", | ||
| "LITTLE_PEOPLE": "Необходимо минимум два человека!", | ||
| "START_GAME": "Игра начинается через", | ||
| "LETS_GO": "Поехали!", | ||
| "NOT_ENOUGH_PHOTO": "Не все пользователи загрузили фотографии!", | ||
| "GAME_GO": "Игра уже идет!", | ||
| "CHOOSE": "Выбирай!", | ||
| "ALR_VOTED": "Вы уже отдали свой голос!", | ||
| "FIRST_WIN": "И в текущем сражении победителем стал обладатель первой картинки!", | ||
| "SECOND_WIN": "И в текущем сражении победителем стал обладатель второй картинки!", | ||
| "DRAW": "Никто не победил - следовательно оба вылетают.", | ||
| "RANDOM_WIN": "Никто не проголосовал, поэтому победитель определяется случайным образом.", | ||
| "REMAIN": "Оставшиеся пользователи", | ||
| "GAME_STOP": "Игра остановлена!", | ||
| "GAME_NO_EXIST": "Игровая сессия не запущена!", | ||
| "ADMIN_COMMAND": "Данная команда вам недоступна!", | ||
| "USER_KICKED": "Пользователь исключен!", | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
посмотри новый синтакс юез лупа