예제 #1
0
파일: bot.py 프로젝트: Myuusu/JapanBotV2
 async def get_prefix(self, message):
     try:
         self.guild_list[message.guild.id].message_count += 1
     except KeyError:
         self.guild_list.update(
             {message.guild.id: Guild(guild_id=message.guild.id)})
     finally:
         return self.guild_list[message.guild.id].prefix
예제 #2
0
async def on_ready():
    """Initial function to run when the bot is ready to function"""
    await bot.change_presence(activity=discord.Activity(
        type=discord.ActivityType.playing, name="@Pandora's Bot for help"))

    print("Generating Objects...")

    # collect new guild ids and create objects for them
    new_ids = {guild.id for guild in bot.guilds} - set(Guild._guilds.keys())

    # Create new Guild objects
    new_guilds = [Guild(id) for id in new_ids]

    print("Updating database...")
    db.update(*new_guilds)

    print("Ready Player One.")
예제 #3
0
파일: bot.py 프로젝트: Myuusu/JapanBotV2
 async def on_guild_remove(self, guild):
     self.guild_list.update(
         {guild.id: Guild(guild_id=guild.id, active=False)})
예제 #4
0
파일: bot.py 프로젝트: Myuusu/JapanBotV2
 async def on_guild_join(self, guild):
     self.guild_list.update(
         {guild.id: Guild(guild_id=guild.id, active=True)})
예제 #5
0
async def on_guild_remove(guild):
    """Bot was removed from a server"""
    Guild.pop(guild.id, None)

    # remove from DB
    db.delete_guild(guild.id)
예제 #6
0
async def on_guild_join(guild):
    """Bot joined a new server"""
    guild = Guild(guild.id)
    db.update(guild)
예제 #7
0
from classes import Guild

guild_list = {
    333308985455411200: Guild(
        guild_id=333308985455411200,
        prefix=['>'],
        message_count=0,
        active=True,
        log_channel_id=None
    ),
    193779929006080009: Guild(
        guild_id=193779929006080009,
        prefix=['`'],
        message_count=0,
        active=True,
        log_channel_id=None
    ),
    710111046031114362: Guild(
        guild_id=710111046031114362,
        prefix=['!'],
        message_count=20500,
        active=True,
        log_channel_id=732948310880550974
    ),
    723250564380622891: Guild(
        guild_id=723250564380622891,
        prefix=['!'],
        message_count=0,
        active=True,
        log_channel_id=None
    ),