예제 #1
0
	def __init__(self, *args, **kwargs):
		super().__init__(*args, **kwargs)

		self.support_server_invite = "https://discord.gg/MKyWA5M"
		self.invite = "https://discord.com/oauth2/authorize?client_id=756206646396452975&scope=bot&permissions=268723414&applications.commands"
		self.ipc = ipc.Server(self, secret_key=IPC_TOKEN)
		self.is_dev = False
예제 #2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.ipc = ipc.Server(
            self, secret_key="my_secret_key")  # create our IPC Server

        self.load_extension("cogs.ipc")  # load the IPC Route cog
예제 #3
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.ipc = ipc.Server(
         self,
         host="0.0.0.0",
         port=6000,
         secret_key=os.environ["SPARTA_SECRET_KEY"],
     )
예제 #4
0
 def __init__(self):
     super().__init__(command_prefix=self.determine_prefix,
                      description="API",
                      loop=asyncio.new_event_loop(),
                      intents=discord.Intents.default(),
                      case_insensitive=True,
                      help_command=None)
     self.ipc = ipc.Server(self, secret_key="Swas")
예제 #5
0
    def __init__(self, *args, **kwargs):
        super().__init__(get_prefix,
                         description="A moderation / fun bot",
                         intents=intents,
                         allowed_mentions=discord.AllowedMentions.none(),
                         activity=discord.Activity(
                             type=discord.ActivityType.listening,
                             name="@Penguin"),
                         owner_ids={447422100798570496},
                         **kwargs)

        self._logger = logging.getLogger(__name__)

        self.loop = asyncio.get_event_loop()
        self.session = aiohttp.ClientSession()

        self.start_time = dt.datetime.now()

        with open("config.json") as res:
            self.config = json.load(res)

        self.ipc = ipc.Server(self, "localhost", self.config['ipc-port'],
                              self.config['ipc-key'])
        self.load_extension("utils.ipc")

        self.db = self.loop.run_until_complete(
            asyncpg.create_pool(**self.config['db']))

        # Cache stuff
        self.stats = {}
        self.prefixes = {}
        self.cache = {}
        self.disabledCommands = []
        self.blacklistedUsers = []
        self.reactionRoleDict = self.loop.run_until_complete(
            self.cache_reactionroles())

        records = self.loop.run_until_complete(
            self.db.fetch("SELECT * FROM blacklist"))
        for i in records:
            self.blacklistedUsers.append(i["id"])

        records = self.loop.run_until_complete(
            self.db.fetch("SELECT * FROM guild_config"))
        self.prefixes = dict(
            self.loop.run_until_complete(
                self.db.fetch("SELECT id, prefix FROM guild_config")))

        for record in records:
            d = self.refresh_template(record)
            self.cache.update(d)

        self.get_announcement()
        self.dagpi_client = Client(self.config['dagpi'])
        self.command_stats = {}
        self.mystbin = mystbin.Client()

        self.load_cogs()
예제 #6
0
파일: bot.py 프로젝트: Axelancerr/Life
    def __init__(self) -> None:
        super().__init__(
            status=discord.Status.dnd,
            activity=discord.Activity(type=discord.ActivityType.playing,
                                      name="aaaaa!"),
            allowed_mentions=discord.AllowedMentions(everyone=False,
                                                     users=True,
                                                     roles=True,
                                                     replied_user=False),
            help_command=custom.HelpCommand(),
            intents=discord.Intents.all(),
            command_prefix=self.get_prefix,
            case_insensitive=True,
            owner_ids=config.OWNER_IDS,
        )
        self._BotBase__cogs = commands.core._CaseInsensitiveDict()

        self.session: aiohttp.ClientSession = aiohttp.ClientSession()
        self.process: psutil.Process = psutil.Process()
        self.socket_stats: collections.Counter = collections.Counter()

        self.ERROR_LOG: discord.Webhook = discord.Webhook.from_url(
            session=self.session, url=config.ERROR_WEBHOOK_URL)
        self.GUILD_LOG: discord.Webhook = discord.Webhook.from_url(
            session=self.session, url=config.GUILD_WEBHOOK_URL)
        self.DMS_LOG: discord.Webhook = discord.Webhook.from_url(
            session=self.session, url=config.DM_WEBHOOK_URL)

        self.db: asyncpg.Pool = utils.MISSING
        self.redis: aioredis.Redis | None = None

        self.scheduler: aioscheduler.Manager = aioscheduler.Manager()
        self.mystbin: mystbin.Client = mystbin.Client(session=self.session)
        self.slate: obsidian.NodePool[Life, custom.Context,
                                      custom.Player] = obsidian.NodePool()
        self.ipc: ipc.Server = ipc.Server(bot=self,
                                          secret_key=config.SECRET_KEY,
                                          multicast_port=config.MULTICAST_PORT)

        self.topgg: topgg.DBLClient | None = topgg.DBLClient(
            bot=self, token=config.TOPGG, autopost=True
        ) if config.ENV is enums.Environment.PRODUCTION else None

        self.user_manager: managers.UserManager = managers.UserManager(
            bot=self)
        self.guild_manager: managers.GuildManager = managers.GuildManager(
            bot=self)

        self.first_ready: bool = True
        self.start_time: float = time.time()

        self.add_check(checks.global_check, call_once=True)  # type: ignore

        self.converters |= values.CONVERTERS
예제 #7
0
    def __init__(self, *args, **kwargs):
        # intents
        intents = discord.Intents.default()
        intents.guilds = True

        # init
        self.config = utils.load_bot_config()
        super().__init__(command_prefix=self.config['prefix'],
                         intents=intents,
                         *args,
                         **kwargs)

        # ipc server for web requests
        self.ipc_server = ipc.Server(self,
                                     secret_key=self.config['ipc_key'],
                                     port=self.config['ipc_port'])
예제 #8
0
    def __init__(self, **kwargs):
        super().__init__(
            **kwargs,
            command_prefix=get_prefix,
            owner_ids=[668906205799907348, 746807014658801704],
            case_insensitive=True,
        )

        # Cogs

        self.coglist = [
            f"cogs.{item[:-3]}"
            for item in os.listdir("/storage/emulated/0/PacMe/cogs")
            if item != "__pycache__"
        ] + ["jishaku"] + ["listeners.error"]
        for extension in self.coglist:
            try:
                self.load_extension(extension)
            except Exception as e:
                print(e)

        # Cache

        self.cache = {}

        # Config
        self.ipc = ipc.Server(self, secret_key="ConfirmItsMe")
        self._token = secret_file["token"]
        self.dagpi = secret_file["dagpi"]
        self.asyncpg = secret_file['postgres']
        self.blacklist = set()
        self.embed_color = 0x8936FF
        self.embed_colour = self.embed_color
        self.maint = False
        self.maintenence = False
        self._underscore = True
        self.mystbin = mystbin.Client()
        self.start_time = datetime.datetime.utcnow()
        self.emoji_dict = {
            "greyTick": "<:greyTick:596576672900186113>",
            "greenTick": "<:greenTick:820316551340490752>",
            "redTick": "<:redTick:820319748561829949>",
            "dpy": "<:dpy:596577034537402378>",
            "py": "<:python:286529073445076992>"
        }
        self.custom_errors = utils.errors
예제 #9
0
파일: bot.py 프로젝트: oliver-ni/2022-bot
    def __init__(self, **kwargs):
        super().__init__(
            **kwargs,
            command_prefix=config.PREFIX,
            intents=discord.Intents.all(),
            allowed_mentions=discord.AllowedMentions(everyone=False, roles=False),
            case_insensitive=True,
        )

        self.config = config
        self.ipc = ipc.Server(self, secret_key=config.SECRET_KEY)

        self.load_extension("jishaku")
        for i in DEFAULT_COGS:
            self.load_extension(f"cogs.{i}")

        for i in getattr(config, "EXTRA_COGS", []):
            self.load_extension(f"cogs.{i}")
예제 #10
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.loop = asyncio.get_event_loop()
        self.ranks = {}
        self.db = self.loop.run_until_complete(aiosqlite.connect('bot.db'))

        self.loop.run_until_complete(
            self.db.execute("""
        CREATE TABLE IF NOT EXISTS ranks (
        userID BIGINT PRIMARY KEY,
        xp BIGINT DEFAULT 0);"""))
        self.ranks = self.loop.run_until_complete(self.get_ranks())
        self.loop.run_until_complete(self.initialize_db())
        self.blacklist = self.loop.run_until_complete(self.get_blacklist())
        self.level_roles = self.loop.run_until_complete(self.get_roles())

        #IPC server setup
        self.ipc = ipc.Server(self, "localhost", 8765, settings.ipc_key())
예제 #11
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.remove_command('help')
     self._commands = 0
     self.currency_cache = {}
     self.session = ClientSession(loop=self.loop)
     self.dag = Client(dagpi_token, loop=self.loop)
     self.mystbin = mystbin.Client()
     self._start = time.time()
     self._prefixes = json.load(open('./prefixes.json', 'r'))
     self._banned = json.load(open('./bans.json', 'r'))
     self._edit_cache = {}
     self.cse = cse.Search(google_key)
     self.ipc = ipc.Server(self, 'localhost', 8080, secret_key=ipc_key)
     self.ball = ball()
     self.load_extension('jishaku')
     os.environ["JISHAKU_NO_UNDERSCORE"] = "true"
     os.environ["JISHAKU_NO_DM_TRACEBACK"] = "true"
     os.environ["JISHAKU_HIDE"] = "true"
예제 #12
0
    def __init__(self, **options):
        super().__init__(
            get_prefix,
            intents=intent,
            allowed_mentions=discord.AllowedMentions.none(),
            activity=discord.Activity(type=ActivityType.listening,
                                      name="@Harley"),
            **options,
        )

        self._logger = logging.getLogger("Harley")

        self._BotBase__cogs = commands.core._CaseInsensitiveDict()
        self.usage = 0
        self.cache = {}
        self.blacklisted = {}
        self.start_time = datetime.utcnow()
        self.edit_mapping: Dict[Message, Message] = CappedDict(max_size=100)

        self.config = json.load(open("config.json"))
        self.custom_emojis = json.load(open("emojis.json"))

        self._session = aiohttp.ClientSession(loop=self.loop)

        self.ipc = ipc.Server(self, self.config.get("ipc_key"))
        self.load_extension("cogs.ipc")

        self.db = self.loop.run_until_complete(
            asyncpg.create_pool(**self.config["db"]))

        self._dagpi = asyncdagpi.Client(self.config["dagpi"])

        self.cache.update({"default": {"prefix": self.config["prefix"]}})

        self.load_extension("utils.utils")

        self.loop.run_until_complete(self._ainit())

        self.load_cogs()
예제 #13
0
    def __init__(self, get_command_prefix, *args, **kwargs):
        intents = discord.Intents.all()
        allowed_mentions = discord.AllowedMentions(everyone=False, roles=False)
        super().__init__(*args,
                         **kwargs,
                         intents=intents,
                         command_prefix=get_command_prefix,
                         allowed_mentions=allowed_mentions)

        # status
        self.dev = bool(strtobool(
            os.environ["DEV"]))  # from docker compose file
        self.ready = False  # True if entire startup sequence connection done
        self.app_info: Optional[
            AppInfo] = None  # App info (loaded once in on_ready event)

        self.config = dict()  # Bot and server configs in one dictionary
        self.main_channel: Optional[
            discord.
            TextChannel] = None  # Main channel system messages will be sent in

        with open("/run/secrets/ipc-secret") as secret_file:
            secret = secret_file.read()
        self.ipc = ipc.Server(self, secret_key=secret, host="0.0.0.0")
예제 #14
0
파일: bot.py 프로젝트: azenyx/Zenyx-Bot
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.env_vars = {}
        with open('protected_vars.env') as ins:
            for line in ins:
                match = compile(
                    r'''^([^\s=]+)=(?:[\s"']*)(.+?)(?:[\s"']*)$''').match(line)
                if match is not None:
                    self.env_vars[match.group(1)] = match.group(2)

        self.root_path = str(__file__)[:-len("bot.py")]
        self.mongo_client = MongoClient(self.env_vars["SRV_URL"])
        self.ipc = ipc.Server(self, secret_key=self.env_vars["IPC_SECRET"])
        self.COGS = {
            "root": ["website"],
            "cogs": [
                "afk", "audio", "experience_system", "fun",
                "image_manipulation", "image", "misc", "logger", "moderation"
            ],
            "utils":
            ["error_handler", "utility_commands", "help", "ipc_routes"],
            "games": ["trivia_quiz._cog", "connect_4", "battle_ships"]
        }
예제 #15
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.ipc = ipc.Server(self, secret_key="ModernLevels")
예제 #16
0
파일: bot.py 프로젝트: Eris9/Discord.DB
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.ipc = ipc.Server(self, secret_key="Swas")
예제 #17
0
파일: davobot.py 프로젝트: Finleyyy/davobot
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.ipc = ipc.Server(self, "localhost", 8765, ipc_secret)
     self.load_extension("cogs.ipc")
예제 #18
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.ipc = ipc.Server(self, host=os.getenv("IPC_HOST"), port=os.getenv("IPC_PORT"), secret_key=os.getenv("IPC_PASSWORD"))
     self.ipc.start()
예제 #19
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.ipc = ipc.Server(
            self,
            secret_key=config["global"]["ipc_secret"])  # create our IPC Server
예제 #20
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.ipc = ipc.Server(self, secret_key=IPC_SECRET_KEY, host="0.0.0.0")
예제 #21
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.ipc = ipc.Server(self, "localhost", 8765,
                              "my_secret_key")  # create our IPC Server
예제 #22
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.ipc = ipc.Server(self, secret_key="my_secret_key")  # create our IPC Server