tickets_plus.ext.legacy
Legacy Tickets+ features.
This cog contains features that were present in the original Tickets+ bot, but have since been phased out. They are kept here for backwards and allowing for their functionality to still be used, but they are not capable of being enabled. Should the feature stop working, it will be removed from the bot entirely, as the features are not being maintained.
Typical example usage:
from tickets_plus.exr import legacy
1"""Legacy Tickets+ features. 2 3This cog contains features that were present in the original Tickets+ bot, but 4have since been phased out. They are kept here for backwards and allowing for their 5functionality to still be used, but they are not capable of being enabled. 6Should the feature stop working, it will be removed from the bot entirely, 7as the features are not being maintained. 8 9Typical example usage: 10 ```py 11 from tickets_plus.exr import legacy 12 ``` 13""" 14# License: EPL-2.0 15# SPDX-License-Identifier: EPL-2.0 16# Copyright (c) 2021-present The Tickets+ Contributors 17# This Source Code may also be made available under the following 18# Secondary Licenses when the conditions for such availability set forth 19# in the Eclipse Public License, v. 2.0 are satisfied: GPL-3.0-only OR 20# If later approved by the Initial Contributor, GPL-3.0-or-later. 21from __future__ import annotations 22 23import logging 24import string 25import discord 26 27from tickets_plus.database import models, layer 28 29 30async def thread_create(channel: discord.TextChannel, guild: models.Guild, confg: layer.OnlineConfig) -> discord.Thread: 31 nts_thrd: discord.Thread = await channel.create_thread( 32 name="Staff Notes", 33 reason=f"Staff notes for Ticket {channel.name}", 34 auto_archive_duration=10080, 35 ) 36 await nts_thrd.send(string.Template(guild.open_message).safe_substitute(channel=channel.mention)) 37 logging.info("Created thread %s for %s", nts_thrd.name, channel.name) 38 if guild.observers_roles: 39 observer_ids = await confg.get_all_observers_roles(guild.guild_id) 40 inv = await nts_thrd.send(" ".join([f"<@&{role.role_id}>" for role in observer_ids])) 41 await inv.delete() 42 return nts_thrd
async def
thread_create( channel: discord.channel.TextChannel, guild: tickets_plus.database.models.Guild, confg: tickets_plus.database.layer.OnlineConfig) -> discord.threads.Thread:
31async def thread_create(channel: discord.TextChannel, guild: models.Guild, confg: layer.OnlineConfig) -> discord.Thread: 32 nts_thrd: discord.Thread = await channel.create_thread( 33 name="Staff Notes", 34 reason=f"Staff notes for Ticket {channel.name}", 35 auto_archive_duration=10080, 36 ) 37 await nts_thrd.send(string.Template(guild.open_message).safe_substitute(channel=channel.mention)) 38 logging.info("Created thread %s for %s", nts_thrd.name, channel.name) 39 if guild.observers_roles: 40 observer_ids = await confg.get_all_observers_roles(guild.guild_id) 41 inv = await nts_thrd.send(" ".join([f"<@&{role.role_id}>" for role in observer_ids])) 42 await inv.delete() 43 return nts_thrd