コード例 #1
0
def test_intents_has_required_permissions():
    expected = Intents.none()
    expected.guilds = True
    expected.emojis = True
    expected.messages = True
    expected.reactions = True
    expected.voice_states = True
    assert intents() == expected
コード例 #2
0
ファイル: main.py プロジェクト: monkeydg/pog-bot
def main(launch_str=""):

    _define_log(launch_str)

    # Init order MATTERS

    log.info("Starting init...")

    # Get data from the config file
    cfg.get_config(launch_str)

    # Set up intents
    intents = Intents.none()
    intents.guilds = True
    intents.members = True
    intents.bans = False
    intents.emojis = False
    intents.integrations = False
    intents.webhooks = False
    intents.invites = False
    intents.voice_states = False
    intents.presences = True
    intents.messages = True
    # intents.guild_messages Activated by the previous one
    # intents.dm_messages Activated by the previous one
    intents.reactions = False
    # intents.guild_reactions
    # intents.dm_reactions
    intents.typing = False
    intents.guild_typing = False
    intents.dm_typing = False
    client = commands.Bot(command_prefix=cfg.general["command_prefix"],
                          intents=intents)

    # Remove default help
    client.remove_command('help')

    # Initialise db and get all the registered users and all bases from it
    modules.database.init(cfg.database)
    modules.database.get_all_elements(Player.new_from_data, "users")
    modules.database.get_all_elements(Base, "static_bases")
    modules.database.get_all_elements(Weapon, "static_weapons")

    # Get Account sheet from drive
    modules.accounts_handler.init(cfg.GAPI_JSON)

    # Establish connection with Jaeger Calendar
    modules.jaeger_calendar.init(cfg.GAPI_JSON)

    # Initialise display module
    ContextWrapper.init(client)

    # Init lobby
    modules.lobby.init(Match, client)

    # Init stat processor
    modules.stat_processor.init()

    # Add init handlers
    _add_init_handlers(client)

    if launch_str == "_test":
        _test(client)

    # Add all cogs
    modules.loader.init(client)

    # Run server
    client.run(cfg.general["token"])
コード例 #3
0
ファイル: Bloxlink.py プロジェクト: yogurtsyum/Bloxlink
            return wrapper

        return decorator

    @staticmethod
    def flags(fn):
        fn.__flags__ = True
        return fn

    Permissions = Permissions.Permissions  # pylint: disable=no-member

    def __repr__(self):
        return "< Bloxlink Client >"


intents = Intents.none()

intents.members = True  # pylint: disable=assigning-non-slot
intents.guilds = True  # pylint: disable=assigning-non-slot
intents.guild_reactions = True  # pylint: disable=assigning-non-slot
intents.guild_messages = True  # pylint: disable=assigning-non-slot
intents.dm_messages = True  # pylint: disable=assigning-non-slot
intents.bans = True  # pylint: disable=assigning-non-slot

if RELEASE == "PRO":
    intents.guild_typing = True  # pylint: disable=assigning-non-slot

Bloxlink = BloxlinkStructure(
    chunk_guilds_at_startup=False,
    shard_count=SHARD_COUNT,
    shard_ids=SHARD_RANGE,
コード例 #4
0
# # attributes.py, Created by Janrey "CodexLink" Licas
# ! A set of attributes to pass on Entrpoint's Constructor to Instantiate Discord Bot and other Subclasses.
# * Seperated for Code Clarity and Focused Environment specifically for Entrypoint.

from collections import namedtuple
from discord import Activity, Intents, CustomActivity, PartialEmoji
from .constants import RP_ATTRS_DEFAULT
from datetime import datetime as dt
"""
# Bot's Intents

* I'm not gonna use default()'s intents. But rather, have to declare them
* on my own. This was done to properly include 'only' important features of the bot.
"""

attr_intents = Intents.none()

attr_intents.bans = True  # Has the right to ban people from manipulating the bot.
attr_intents.emojis = False  # Has no access to emojis for reacts in general.
attr_intents.invites = True  # Disallow people from inviting this bot because it doesn't make any difference.
attr_intents.messages = False  # Has no access to messages for reacts in general.
attr_intents.presences = True  # Has access to presence for presence record to Firebase.
attr_intents.dm_messages = True  # Has access to Direct Message, specifically.
attr_intents.dm_reactions = (
    True  # Has access to Direct Message Reactions, specifically.
)
"""
# Bot's Presence Activity

* All Possible Configurations were Added.
! But not all of them will be displayed since it was a bot who uses it.