Example #1
0
    async def mark(self, ctx: commands.Context, channel_type: str):
        """
        Marks the current channel as a queue or ranking channel
        """
        if channel_type.upper() == "QUEUE":
            queue_channel_handler.mark_queue_channel(ctx.channel.id, ctx.guild.id)

            await ctx.send(f"Current channel marked as a queue channel", delete_after=5)
            await ctx.message.delete(delay=5)

        # TODO Handle RANKING
        else:
            await ctx.send("Accepted values for !admin mark are QUEUE and RANKING")
Example #2
0
    async def mark(self, ctx: commands.Context, channel_type: str):
        """
        Marks the current channel as a queue or ranking channel
        """
        if channel_type.upper() == "QUEUE":
            queue_channel_handler.mark_queue_channel(ctx.channel.id,
                                                     ctx.guild.id)

            await ctx.send(f"Current channel marked as a queue channel")

        elif channel_type.upper() == "RANKING":
            ranking_channel_handler.mark_ranking_channel(
                channel_id=ctx.channel.id, server_id=ctx.guild.id)
            await ctx.send(f"Current channel marked as a ranking channel")

        else:
            await ctx.send(
                "Accepted values for !admin mark are QUEUE and RANKING")
import pytest

from inhouse_bot.common_utils.fields import roles_list
from inhouse_bot import game_queue
from inhouse_bot.game_queue import GameQueue

# Ideally, that should not be hardcoded
# This needs to be called after the first part is it creates a session
from inhouse_bot.queue_channel_handler import queue_channel_handler

# This will recreate the tables and mark the channels as possible queues
queue_channel_handler.mark_queue_channel(0, 0)
queue_channel_handler.mark_queue_channel(1, 0)
queue_channel_handler.mark_queue_channel(2, 0)


def test_queue_full():
    game_queue.reset_queue()

    for player_id in range(0, 10):
        game_queue.add_player(player_id,
                              roles_list[player_id % 5],
                              0,
                              0,
                              name=str(player_id))

    assert len(GameQueue(0)) == 10

    # We queue our player 0 in channel 1, which he should be allowed to do
    game_queue.add_player(0, roles_list[0], 1, 0, name="0")
    assert len(GameQueue(1)) == 1