async def add_raid_phrase(self, phrase: str) -> bool: existing = self.guild().raid_phrases.filter(word=phrase) if (len(existing) > 0): return False Guild.objects(_id=self.guild_id).update_one( push__raid_phrases=FilterWord(word=phrase, bypass=5, notify=True)) return True
async def add_filtered_word(self, fw: FilterWord) -> None: existing = self.guild().filter_words.filter(word=fw.word) if (len(existing) > 0): return False Guild.objects(_id=self.guild_id).update_one(push__filter_words=fw) return True
async def remove_ignored_channel(self, id: int): g = Guild.objects(_id=self.guild_id) g2 = g.first() if id in g2.filter_excluded_channels: g.update_one(pull__filter_excluded_channels=id) return True return False
async def remove_whitelisted_guild(self, id: int): g = Guild.objects(_id=self.guild_id) g2 = g.first() if id in g2.filter_excluded_guilds: g.update_one(pull__filter_excluded_guilds=id) return True return False
async def get_tag_by_name(self, name: str, args: bool): g = Guild.objects(_id=self.guild_id).first() for t in g.tags: if t.name == name and t.args == args: t.use_count += 1 g.save() return t return None
async def get_tag(self, name: str): g = Guild.objects(_id=self.guild_id).first() for t in g.tags: if t.name == name: t.use_count += 1 g.save() return t return None
async def get_tag(self, _id: int): g = Guild.objects(_id=self.guild_id).first() for t in g.tags: if t._id == _id: t.use_count += 1 g.save() return t return None
def guild(self) -> Guild: """Returns the state of the main guild from the database. Returns ------- Guild The Guild document object that holds information about the main guild. """ return Guild.objects(_id=self.guild_id).first()
async def inc_caseid(self) -> None: """Increments Guild.case_id, which keeps track of the next available ID to use for a case. """ Guild.objects(_id=self.guild_id).update_one(inc__case_id=1)
async def edit_tag(self, tag): return Guild.objects(_id=self.guild_id, tags__name=tag.name).update_one(set__tags__S=tag)
async def remove_tag(self, tag: str): return Guild.objects(_id=self.guild_id).update_one( pull__tags__name=Tag(name=tag).name)
async def add_tag(self, tag: Tag) -> None: Guild.objects(_id=self.guild_id).update_one(push__tags=tag)
async def setup(): print("STARTING SETUP...") guild = Guild() # you should have this setup in the .env file beforehand guild._id = int(os.environ.get("CHROMEY_MAINGUILD")) guild.case_id = 1 guild.role_birthday = 123 # put in the role IDs for your server here guild.role_nerds = 123 # put in the role IDs for your server here guild.role_moderator = 123 # put in the role IDs for your server here guild.role_mute = 123 # put in the role IDs for your server here guild.role_helpers = 123 guild.role_rules = 123 guild.role_timeout = 123 guild.channel_offtopic = 123 # put in the channel IDs for your server here guild.channel_private = 123 # put in the channel IDs for your server here guild.channel_reaction_roles = 123 # put in the channel IDs for your server here guild.channel_reports = 123 # put in the channel IDs for your server here guild.channel_support = 123 # put in the channel IDs for your server here guild.channel_deals = 123 # put in the channel IDs for your server here guild.channel_modlogs = 123 # put in the channel IDs for your server here guild.logging_excluded_channels = [] # put in a channel if you want (ignored in logging) guild.filter_excluded_channels = [] # put in a channel if you want (ignored in filter) guild.filter_excluded_guilds = [] # put guild ID to whitelist in invite filter if you want guild.save() print("DONE")
async def add_locked_channels(self, channel): Guild.objects(_id=self.guild_id).update_one( push__locked_channels=channel)
async def save_emoji_webhook(self, id): g = Guild.objects(_id=self.guild_id).first() g.emoji_logging_webhook = id g.save()
async def remove_tag(self, _id: int): return Guild.objects(_id=self.guild_id).update_one(pull__tags___id=Tag( _id=_id)._id)
async def setup(): print("STARTING SETUP...") guild = Guild() # you should have this setup in the .env file beforehand guild._id = int(os.environ.get("BOTTY_MAINGUILD")) guild.nsa_guild_id = int(os.environ.get("BOTTY_NSAGUILD")) guild.case_id = 11154 guild.role_dev = 123 # put in the role IDs for your server here guild.role_genius = 123 # put in the role IDs for your server here guild.role_member = 123 # put in the role IDs for your server here guild.role_memberedition = 123 # put in the role IDs for your server here guild.role_memberplus = 123 # put in the role IDs for your server here guild.role_memberpro = 123 # put in the role IDs for your server here guild.role_moderator = 123 # put in the role IDs for your server here guild.role_mute = 123 # put in the role IDs for your server here guild.role_sub_mod = 123 # put in the role IDs for your server here guild.role_sub_news = 123 # put in the role IDs for your server here guild.channel_booster_emoji = 123 # put in the channel IDs for your server here guild.channel_botspam = 123 # put in the channel IDs for your server here guild.channel_common_issues = 123 # put in the channel IDs for your server here guild.channel_emoji_log = 123 # put in the channel IDs for your server here guild.channel_private = 123 # put in the channel IDs for your server here guild.channel_public = 123 # put in the channel IDs for your server here guild.channel_reaction_roles = 123 # put in the channel IDs for your server here guild.channel_reports = 123 # put in the channel IDs for your server here guild.channel_subnews = 123 # put in the channel IDs for your server here guild.channel_music = 123 # put in the channel IDs for your server here guild.logging_excluded_channels = [ ] # put in a channel if you want (ignored in logging) guild.filter_excluded_channels = [ ] # put in a channel if you want (ignored in filter) guild.filter_excluded_guilds = [ ] # put guild ID to whitelist in invite filter if you want guild.save() print("DONE")
async def remove_locked_channels(self, channel): Guild.objects(_id=self.guild_id).update_one( pull__locked_channels=channel)
async def remove_filtered_word(self, word: str): return Guild.objects(_id=self.guild_id).update_one( pull__filter_words__word=FilterWord(word=word).word)
async def remove_raid_phrase(self, phrase: str): Guild.objects(_id=self.guild_id).update_one( pull__raid_phrases__word=FilterWord(word=phrase).word)
async def update_filtered_word(self, word: FilterWord): return Guild.objects( _id=self.guild_id, filter_words__word=word.word).update_one(set__filter_words__S=word)
async def set_spam_mode(self, mode) -> None: Guild.objects(_id=self.guild_id).update_one( set__ban_today_spam_accounts=mode)
async def add_filtered_word(self, fw: FilterWord) -> None: Guild.objects(_id=self.guild_id).update_one(push__filter_words=fw)