base.requirements.txt
This commit is contained in:
parent
f43cace124
commit
e2ed3a97be
@ -1,7 +1,9 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM python:3.9
|
||||
FROM python:3.10
|
||||
WORKDIR /v6
|
||||
ENV v6root=/v6data
|
||||
COPY base.requirements.txt base.requirements.txt
|
||||
RUN pip install -r base.requirements.txt
|
||||
COPY requirements.txt requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
COPY v6d3losyash v6d3losyash
|
||||
|
2
base.requirements.txt
Normal file
2
base.requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
aiohttp~=3.7.4.post0
|
||||
discord.py~=1.7.3
|
@ -1,4 +1,5 @@
|
||||
aiohttp~=3.7.4.post0
|
||||
discord.py~=1.7.3
|
||||
git+https://gitea.parrrate.ru/PTV/v6d1tokens.git@c4c6cf43b1082c666e6891f73df825acee6ae86d
|
||||
git+https://gitea.parrrate.ru/PTV/v6d2ctx.git@096314b9bbb6153a9a75afcc16ddf7833384df18
|
||||
ptvp35 @ git+https://gitea.parrrate.ru/PTV/ptvp35.git@c9cdbf86a67eaf817baf0bc23e0440b54c070362
|
||||
v6d0auth @ git+https://gitea.parrrate.ru/PTV/v6d0auth.git@c4b7a4900d36cb74b5aa544864cbbd3125415bb4
|
||||
v6d1tokens @ git+https://gitea.parrrate.ru/PTV/v6d1tokens.git@22c9784d20d6d9d860d4f1c0da41254db17ab9a2
|
||||
v6d2ctx @ git+https://gitea.parrrate.ru/PTV/v6d2ctx.git@2f0ac33c0228d43b9263ca31f584be2f96ad84eb
|
||||
rainbowadn @ git+https://gitea.parrrate.ru/PTV/rainbowadn.git@add1e7cdbf817811d4b85baec63ed0b87ae96dae
|
||||
|
@ -0,0 +1,3 @@
|
||||
__all__ = ('config',)
|
||||
|
||||
import v6d3losyash.config as config
|
@ -78,7 +78,9 @@ class SimpleEmoji:
|
||||
if isinstance(self.ref, str):
|
||||
return self.ref
|
||||
else:
|
||||
return client.get_emoji(self.ref)
|
||||
emoji = client.get_emoji(self.ref)
|
||||
assert emoji is not None
|
||||
return emoji
|
||||
|
||||
|
||||
class RoleGrant:
|
||||
@ -87,7 +89,9 @@ class RoleGrant:
|
||||
self.emoji = emoji
|
||||
|
||||
def format(self) -> str:
|
||||
guild: discord.Guild = client.get_guild(config.guild)
|
||||
guild_ = client.get_guild(config.guild)
|
||||
assert guild_ is not None
|
||||
guild: discord.Guild = guild_
|
||||
return f'{self.emoji.to()} {guild.get_role(self.role)}'
|
||||
|
||||
|
||||
@ -109,8 +113,12 @@ class ChannelDescription:
|
||||
|
||||
|
||||
def role_channel() -> discord.TextChannel:
|
||||
guild: discord.Guild = client.get_guild(config.guild)
|
||||
channel: discord.TextChannel = guild.get_channel(config.role_channel)
|
||||
guild_ = client.get_guild(config.guild)
|
||||
assert guild_ is not None
|
||||
guild: discord.Guild = guild_
|
||||
channel_ = guild.get_channel(config.role_channel)
|
||||
assert isinstance(channel_, discord.TextChannel)
|
||||
channel: discord.TextChannel = channel_
|
||||
return channel
|
||||
|
||||
|
||||
@ -154,6 +162,7 @@ class State:
|
||||
self.defmap = {key: msid for msid, key in self.defrev.items()}
|
||||
|
||||
async def _clear_channel(self):
|
||||
assert client.user is not None
|
||||
msg: discord.Message
|
||||
async for msg in role_channel().history(limit=100):
|
||||
if msg.author.id == client.user.id and msg.id not in self.defrev:
|
||||
@ -180,7 +189,9 @@ class State:
|
||||
await message.clear_reaction(emoji.to())
|
||||
return None, None
|
||||
guild: discord.Guild = await client.fetch_guild(config.guild)
|
||||
role: discord.Role = guild.get_role(role_id)
|
||||
role_ = guild.get_role(role_id)
|
||||
assert role_ is not None
|
||||
role: discord.Role = role_
|
||||
member: discord.Member = await guild.fetch_member(member_id)
|
||||
return role, member
|
||||
|
||||
@ -219,15 +230,24 @@ state = State(
|
||||
|
||||
|
||||
async def log(msg: str):
|
||||
guild: discord.Guild = client.get_guild(config.guild)
|
||||
channel: discord.TextChannel = guild.get_channel(config.channel)
|
||||
guild_ = client.get_guild(config.guild)
|
||||
assert guild_ is not None
|
||||
guild: discord.Guild = guild_
|
||||
channel_ = guild.get_channel(config.channel)
|
||||
assert isinstance(channel_, discord.TextChannel)
|
||||
channel: discord.TextChannel = channel_
|
||||
await channel.send(msg)
|
||||
|
||||
|
||||
async def grant_citizenship(member_id: int):
|
||||
guild: discord.Guild = client.get_guild(config.guild)
|
||||
member: discord.Member = guild.get_member(member_id)
|
||||
guild_ = client.get_guild(config.guild)
|
||||
assert guild_ is not None
|
||||
guild: discord.Guild = guild_
|
||||
member_ = guild.get_member(member_id)
|
||||
assert member_ is not None
|
||||
member: discord.Member = member_
|
||||
role = guild.get_role(config.role)
|
||||
assert role is not None
|
||||
if role in member.roles:
|
||||
return
|
||||
await member.add_roles(role, reason='феноменально')
|
||||
@ -236,6 +256,7 @@ async def grant_citizenship(member_id: int):
|
||||
|
||||
@client.event
|
||||
async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
|
||||
assert client.user is not None
|
||||
if payload.user_id == client.user.id:
|
||||
return
|
||||
emoji: discord.PartialEmoji = payload.emoji
|
||||
@ -247,6 +268,7 @@ async def on_raw_reaction_add(payload: discord.RawReactionActionEvent):
|
||||
|
||||
@client.event
|
||||
async def on_raw_reaction_remove(payload: discord.RawReactionActionEvent):
|
||||
assert client.user is not None
|
||||
if payload.user_id == client.user.id:
|
||||
return
|
||||
emoji: discord.PartialEmoji = payload.emoji
|
||||
@ -259,7 +281,9 @@ async def on_member_join(member: discord.Member):
|
||||
guild: discord.Guild = member.guild
|
||||
if guild.id != config.guild:
|
||||
return
|
||||
channel: discord.TextChannel = guild.get_channel(config.channel)
|
||||
channel_ = guild.get_channel(config.channel)
|
||||
assert isinstance(channel_, discord.TextChannel)
|
||||
channel: discord.TextChannel = channel_
|
||||
await channel.send(f'{escape(str(member))} {member.id} joined')
|
||||
|
||||
|
||||
@ -268,15 +292,19 @@ async def on_member_remove(member: discord.Member):
|
||||
guild: discord.Guild = member.guild
|
||||
if guild.id != config.guild:
|
||||
return
|
||||
channel: discord.TextChannel = guild.get_channel(config.channel)
|
||||
channel_ = guild.get_channel(config.channel)
|
||||
assert isinstance(channel_, discord.TextChannel)
|
||||
channel: discord.TextChannel = channel_
|
||||
message = await channel.send(f'{escape(str(member))} {member.id} left (joined {member.joined_at})')
|
||||
await asyncio.sleep(1)
|
||||
entry: discord.AuditLogEntry
|
||||
async for entry in guild.audit_logs(action=discord.AuditLogAction.kick):
|
||||
assert entry.target is not None
|
||||
if entry.target.id == member.id:
|
||||
await message.reply(f'latest kick: {entry.created_at} {entry.reason}')
|
||||
break
|
||||
async for entry in guild.audit_logs(action=discord.AuditLogAction.ban):
|
||||
assert entry.target is not None
|
||||
if entry.target.id == member.id:
|
||||
await message.reply(f'latest ban: {entry.created_at} {entry.reason}')
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user