示例#1
0
文件: CoCBot.py 项目: watosar/COCbot
 def __init__(self):
     super().__init__(intents=Intents.all())
     self.owner = None
     self._data_guild_id = None
     self.guild_handler = MultiGuildHandler()
     self.commands = Commands(client=self)
     self.dishelve = None
示例#2
0
    def __init__(
      self, *args, anchor_emoji_path=None, at_sign_emoji_path=None, use_default_system_channel=False, anonc_system_channels_info =[{}], nsfw=False, anchorable_limit=None, use_role=True, show_chat_id=True, anonc_default_name='John Doe', guild_base_name='', **kwargs):
        super().__init__(*args, intents=Intents.all(), **kwargs)

        # TODO : add this
        #   self.number_of_channel_stock = 0
        #   self.channel_stock = deque()
        
        self.anchor_emoji_path = anchor_emoji_path or Path(__file__).parent/'template/msg_anchor.png'
        self.at_sign_emoji_path = at_sign_emoji_path or Path(__file__).parent/'template/at_sign.png'
        
        
        self.anonc_guild = AnoncIntegrationGuild(
            self,
            use_role=use_role,
            nsfw=nsfw,
            channel_limit=300)
        
        self.guild_base_name = guild_base_name
        self.use_default_sys_ch = use_default_system_channel
        self.anonc_sys_chs_info = anonc_system_channels_info
        
        self.show_chat_id = show_chat_id
        
        self.anonc_message_maker = AnoncMessageMaker(self, anonc_default_name)
        self.anchorable_limit = anchorable_limit
        
        self.anonc_ready = asyncio.Event(loop=self.loop)
示例#3
0
    def __init__(self) -> None:
        self.loop: Final[asyncio.AbstractEventLoop] = asyncio.get_event_loop()
        self._owner: Final[int] = 350750086357057537

        super().__init__(
            command_prefix=self.get_prefix,
            case_insensitive=True,
            intents=Intents.all(),
            owner_id=self._owner,
        )

        # aiohttp client session.
        self.session: Final[aiohttp.ClientSession] = aiohttp.ClientSession(
            loop=self.loop
        )

        # bot configs
        self.config = config

        # aiobungie client for destiny stuff.
        self.bungie: Final[aiobungie.Client] = aiobungie.Client(
            self.config.bungie_key, loop=self.loop
        )

        self.pool: Final[asyncpg.Pool] = self.loop.run_until_complete(
            PgPool.__ainit__()
        )

        # Load the cogs
        self.setup()
示例#4
0
    def __init__(self, *, tortoise_config, load_extensions=True, loadjsk=True):
        allowed_mentions = AllowedMentions(users=True,
                                           replied_user=True,
                                           roles=False,
                                           everyone=False)
        super().__init__(
            command_prefix=self.get_custom_prefix,
            intents=Intents.all(),
            allowed_mentions=allowed_mentions,
            description=
            "A bot by and for developers to integrate several tools into one place.",
        )
        self.tortoise_config = tortoise_config
        self.db_connected = False
        self.prefix_cache = {}
        self.connect_db.start()

        if load_extensions:
            self.load_extensions((
                "bot.core",
                "bot.cogs.admin",
                "bot.cogs.thank",
                "bot.cogs.stackexchange",
                "bot.cogs.github",
                "bot.cogs.help_command",
                "bot.cogs.code_exec",
                "bot.cogs.fun",
                "bot.cogs.rtfm",
                "bot.cogs.joke",
                "bot.cogs.utils",
                "bot.cogs.brainfeed",
            ))
        if loadjsk:
            self.load_extension("jishaku")
示例#5
0
 def __init__(self):
     self.PREFIX = PREFIX
     self.ready = False
     self.guild = None
     self.USERS = []
     self.importUsers()
     super().__init__(command_prefix=PREFIX, intents=Intents.all())
示例#6
0
    def __init__(self):
        super().__init__(command_prefix=_get_prefix,
                         description="A Modular SwapBot!",
                         fetch_offline_members=False,
                         intents=Intents.all())

        self.prefixes = config_manager.load_key("bot_prefixes", List[str])
        self.extensions_dir = "modules"
        self.start_time = None
        self.approved_bots = config_manager.load_key("approved_bots",
                                                     List[int])
        self.default_color = config_manager.load_key("default_color",
                                                     List[int])
        self.bot_token = config_manager.load_key("bot_token", str)
        self.session = None

        # Load extensions from folders
        for module in iglob(self.extensions_dir + "/**/*.py", recursive=True):
            module = module.replace(".py", '').replace(sep, '.')
            try:
                self.load_extension(module)
                print(f'Loaded module {module}')
            except:
                print(f"Failed to load module {module}.")
                traceback.print_exc()
        print()  # Blank line for aesthetics
 def __init__(self):
     super().__init__(
         command_prefix='!',
         help_command=None,
         intents=Intents.all()
     )
     AutoCogs(self)
示例#8
0
 def __init__(self):
     self.PREFIX = PREFIX
     self.ready = False
     self.guild = None
     self.scheduler = AsyncIOScheduler()
     super().__init__(command_prefix=PREFIX,
                      owner_ids=OWNER_IDS,
                      Intents=Intents.all())
示例#9
0
    def __init__(self):

        self.scheduler = AsyncIOScheduler()
        self.ready = False

        db.autosave(self.scheduler)

        super().__init__(command_prefix=get_prefix, owner_ids=OWNER, intents=Intents.all())
示例#10
0
 def __init__(self):
     self.prefix = "!"  #Bot Prefix
     try:
         with open("./data/banlist.txt", "r") as f:
             self.banlist = [int(line) for line in f.readlines()]
     except FileNotFoundError:
         self.banlist = []
     super().__init__(command_prefix=self.prefix, intents=Intents.all())
示例#11
0
def init_bot():
    intents = Intents.all()
    bot = commands.Bot("!", case_insensitive=True, intents=intents)
    bot.add_cog(Academy(bot))
    bot.add_cog(Admin(bot))
    misc = Misc(bot)
    bot.add_cog(misc)
    bot.help_command.cog = misc
    return bot
示例#12
0
def get_intents() -> Intents:
    intents = Intents.all()
    intents.typing = False
    intents.dm_reactions = False
    # intents.reactions = False
    # Sentdebot NEEDS MEMBERS PRIVILEGED INTENT
    # intents.members = True
    # intents.presences = True
    return intents
示例#13
0
 def __init__(self):
     self.db = conf.Database()
     super().__init__(
         command_prefix=self.get_prefix, # We get the prefix from the `get_prefix` function
         intents=Intents.all(), # You don't really need all intents enabled.
         description="a cool bot made with discord.py and asyncpg",
         owner_id=int, # Change `int` to your discord ID
         case_insensitive=True # Allwoing commands to be case insensitive for an example "ping" and "PING" are the same
     )
示例#14
0
 def __init__(self, command_prefix: str):
     super().__init__(command_prefix,
                      activity=discord.Game(name="Commands: !help"),
                      intents=Intents.all())
     self._applications = dict()
     self._channels = dict()
     self._load_extensions()
     self._verify_commands_order()
     self._channels_being_updated = set()
示例#15
0
    def create(cls) -> "Bot":
        """Creates and returns a bot instance"""
        loop = asyncio.get_event_loop()

        return cls(command_prefix="$",
                   loop=loop,
                   case_insensitive=True,
                   intents=Intents.all(),
                   activity=Activity(type=discord.ActivityType.listening,
                                     name="forgot prefix? ping me"))
    def __init__(self):
        super().__init__(command_prefix=when_mentioned_or(const.BOT_PREFIX), intents=Intents.all())
        print(f"Launching {const.BOT_NAME}")

        for cog in Path("cogs/").glob("*.py"):
            try:
                self.load_extension("cogs." + cog.stem)
                print(f"Loaded Extension: {cog.stem}.py")
            except Exception:
                print_exc()
示例#17
0
    def __init__(self):
        self.ready = False
        self.cogs_ready = Ready()
        self.guild = False
        self.scheduler = AsyncIOScheduler()

        db.autosave(self.scheduler)
        super().__init__(command_prefix=get_prefix,
                         owner_ids=OWNER_IDS,
                         intents=Intents.all())
示例#18
0
    def __init__(self):
        self.PREFIX = PREFIX
        self.ready = False
        self.cogs_ready = Ready()
        self.guild = None
        self.scheduler = BlockingScheduler(timezone=utc)

        super().__init__(command_prefix=PREFIX,
                         owner_ids=OWNER_IDS,
                         intents=Intents.all())
示例#19
0
    def __init__(self):
        self.PREFIX = PREFIX
        self.ready = False
        self.guild = None
        self.scheduler = AsyncIOScheduler()

        db.autosave(self.scheduler)

        # Inherits BotBase
        super().__init__(command_prefix=PREFIX, intents=Intents.all())
示例#20
0
 def __init__(self):
     self.PREFIX = PREFIX
     self.guild = None
     self.scheduler = AsyncIOScheduler()
     self.ready = False
     #self.TeamList = self.getdata()
     db.autosave(self.scheduler)
     super().__init__(command_prefix=PREFIX,
                      owner_ids=OWNER_IDS,
                      intents=Intents.all())
示例#21
0
    def __init__(self: Bot, config: Data, data: Data, *args, **kwargs):
        super(WatsonBot, self).__init__(command_prefix=config['bot']['prefix'],
                                        intents=Intents.all(),
                                        *args,
                                        **kwargs)
        self.config = config
        self.data = data

        for filename in listdir('./cogs'):
            if filename.endswith('.py') and filename[:-3] not in blacklist:
                self.load_extension(f'cogs.{filename[:-3]}')
示例#22
0
    def __init__(self):
        self.PREFIX = const.PREFIX
        self.ready = False
        self.cogs_ready = Ready()  # Instantiate cogs ready
        self.guild = None
        self.scheduler = AsyncIOScheduler()

        db.autosave(self.scheduler)

        # Inherits BotBase
        super().__init__(command_prefix=const.PREFIX, intents=Intents.all())
示例#23
0
文件: bot.py 项目: dps910/Aqua
    def __init__(self):
        self.status = Status.idle
        # Call superclass commands.Bot. Equal to commands.Bot(command_prefix=self.get_prefix)
        super().__init__(command_prefix=self.get_prefix_,
                         status=self.status,
                         intents=Intents.all())

        self.database = get_event_loop().run_until_complete(
            # ElephantSQL free tier only has a max pool size of 5, so the pool
            # size needs to be set manually.
            create_pool(getenv("DB_URL"), min_size=1, max_size=2))
示例#24
0
 def __init__(self, backoffice):
     helper = Helpers()
     self.bot_settings = helper.read_json_file(file_name='botSetup.json')
     self.integrated_coins = helper.read_json_file(file_name='integratedCoins.json')
     self.list_of_coins = list(self.integrated_coins.keys())
     super().__init__(
         command_prefix=commands.when_mentioned_or(self.bot_settings['command']),
         intents=Intents.all())
     self.remove_command('help')  # removing the old help command
     self.backoffice = backoffice
     self.load_cogs()
示例#25
0
    def __init__(self):
        self.ready = False
        self.cogs_ready = Ready()

        self.scheduler = AsyncIOScheduler()

        db.autosave(self.scheduler)
        super().__init__(command_prefix=get_prefix,
                         owner_ids=OWNER_IDS,
                         help_command=PrettyHelp(color=discord.Color.green()),
                         intents=Intents.all()
                         )
    def __init__(self):
        self._module_types: Set[Type[BaseModule]] = set()
        self._modules: Set[BaseModule] = set()

        self.storage: StorageManager = StorageManager()
        self.timer: TimerManager = TimerManager()
        intents = Intents.all()
        self.bot = commands.Bot(command_prefix=self.storage.config.discord_command_prefix, case_insensitive=True,
                                intents=intents, help_command=AlentoHelpCommand())
        setup_logging()
        self._legacy_module = LegacyModule(self.bot, self.storage, self.timer)
        self._modules.add(self._legacy_module)
示例#27
0
文件: main.py 项目: Bubus2/BuBuSSBot
    def __init__(self):
        self.PREFIX = PREFIX
        self.ready = False
        self.guild = None
        self.scheduler = AsyncIOScheduler()

        database.autosave(self.scheduler)
        super().__init__(
            command_prefix=PREFIX,
            owner_id=OWNER_ID,
            intents=Intents.all(),
        )
示例#28
0
    def __init__(self, command_prefix: str):
        print("bot起動中…")

        # discordに入力するコマンドの接頭語を設定
        super().__init__(command_prefix=command_prefix, intents=Intents.all())

        # チームメーカー
        self.tm = TeamMaker()

        # コグの読み込み
        for cog in COGS:
            self.load_extension(f"{COGS_FOLDER}.{cog}")
示例#29
0
    def __init__(self):
        super().__init__(Intents.all())
        self.prefix = self.get_bot_prefix
        self.description = "Guardian protects your server against NSFW!"

        modules = list(
            map(lambda extension: extension.replace("/", ".")[:-3],
                glob("src/modules/*.py")))

        for index, _ in enumerate(self.load_extensions(modules)):
            Logger.info(
                f"Loaded: {modules[index].replace('src.modules.', '')}")
示例#30
0
    def __init__(self):
        super().__init__(
            command_prefix=when_mentioned_or("!"),
            intents=Intents.all(),
        )
        print("Launching Chimera")

        for cog in Path("cogs/").glob("*.py"):
            try:
                self.load_extension(f"cogs.{cog.stem}")
                print(f"Loaded Extension:{cog.stem}")
            except Exception:
                print_exc()