We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://api.github.com/yepcord/server/blob/29493aa4a0175c99903138a86245c3f92702b3e4/src/rest_api/routes/guilds.py#L41
from time import time from quart import Blueprint, request from quart_schema import validate_request from ..models.guilds import GuildCreate, GuildUpdate, TemplateCreate, TemplateUpdate, EmojiCreate, EmojiUpdate, \ ChannelsPositionsChangeList, ChannelCreate, BanMember, RoleCreate, RoleUpdate, \ RolesPositionsChangeList, AddRoleMembers, MemberUpdate, SetVanityUrl, GuildCreateFromTemplate, GuildDelete from ..utils import usingDB, getUser, multipleDecorators, getGuildWM, getGuildWoM, getGuildTemplate, getRole from ...yepcord.classes.channel import Channel from ...yepcord.classes.guild import Guild, Invite, AuditLogEntry, GuildTemplate, Emoji, Role from ...yepcord.classes.message import Message from ...yepcord.classes.user import User, GuildMember, UserId from ...yepcord.ctx import getCore, getCDNStorage, Ctx from ...yepcord.enums import GuildPermissions, AuditLogEntryType from ...yepcord.errors import InvalidDataErr, Errors from ...yepcord.snowflake import Snowflake from ...yepcord.utils import c_json, getImage, b64decode # Base path is /api/vX/guilds guilds = Blueprint('guilds', __name__) @guilds.post("/", strict_slashes=False) @multipleDecorators(validate_request(GuildCreate), usingDB, getUser) async def create_guild(data: GuildCreate, user: User): guild_id = Snowflake.makeId() if data.icon: img = getImage(data.icon) if h := await getCDNStorage().setGuildIconFromBytesIO(guild_id, img): data.icon = h guild = await getCore().createGuild(guild_id, user, **data.dict(exclude_defaults=True)) Ctx["with_channels"] = True return c_json(await guild.json) @guilds.patch("/<int:guild>") @multipleDecorators(validate_request(GuildUpdate), usingDB, getUser, getGuildWM) async def update_guild(data: GuildUpdate, user: User, guild: Guild, member: GuildMember): await member.checkPermission(GuildPermissions.MANAGE_GUILD) data.owner_id = None # TODO: make guild ownership transfer for image_type, func in (("icon", getCDNStorage().setGuildIconFromBytesIO), ("banner", getCDNStorage().setBannerFromBytesIO), ("splash", getCDNStorage().setGuildSplashFromBytesIO)): if img := getattr(data, image_type): setattr(data, image_type, "") img = getImage(img) if h := await func(guild.id, img): setattr(data, image_type, h) for ch in ("afk_channel_id", "system_channel_id"): if (channel_id := getattr(data, ch)) is not None: if (channel := await getCore().getChannel(channel_id)) is None: setattr(data, ch, None) elif channel.guild_id != guild.id: setattr(data, ch, None) new_guild = guild.copy(**data.dict(exclude_defaults=True)) await getCore().updateGuildDiff(guild, new_guild) await getCore().sendGuildUpdateEvent(new_guild)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://api.github.com/yepcord/server/blob/29493aa4a0175c99903138a86245c3f92702b3e4/src/rest_api/routes/guilds.py#L41
The text was updated successfully, but these errors were encountered: