0.3 #146
@ -1,37 +0,0 @@
|
||||
from cpl_discord.container import Guild
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_data.model.auto_role import AutoRole
|
||||
from bot_data.model.client import Client
|
||||
from bot_data.model.known_user import KnownUser
|
||||
from bot_data.model.level import Level
|
||||
from bot_data.model.server import Server
|
||||
from bot_data.model.user import User
|
||||
from bot_data.model.user_joined_server import UserJoinedServer
|
||||
from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel
|
||||
from modules.stats.model.statistic_result import StatisticResult
|
||||
|
||||
|
||||
async def user_xp_asc(
|
||||
auto_roles: List[AutoRole],
|
||||
clients: List[Client],
|
||||
known_users: List[KnownUser],
|
||||
levels: List[Level],
|
||||
servers: List[Server],
|
||||
user_joined_servers: List[UserJoinedServer],
|
||||
user_joined_voice_channel: List[UserJoinedVoiceChannel],
|
||||
users: List[User],
|
||||
guild: Guild
|
||||
) -> StatisticResult:
|
||||
result = StatisticResult()
|
||||
result.header.append('Name')
|
||||
result.header.append('XP')
|
||||
|
||||
for user in users.order_by(lambda u: u.xp):
|
||||
row = List(str)
|
||||
member = guild.get_member(user.discord_id)
|
||||
row.append(member.name)
|
||||
row.append(str(user.xp))
|
||||
result.values.append(row)
|
||||
|
||||
return result
|
@ -1,37 +0,0 @@
|
||||
from cpl_discord.container import Guild
|
||||
from cpl_query.extension import List
|
||||
|
||||
from bot_data.model.auto_role import AutoRole
|
||||
from bot_data.model.client import Client
|
||||
from bot_data.model.known_user import KnownUser
|
||||
from bot_data.model.level import Level
|
||||
from bot_data.model.server import Server
|
||||
from bot_data.model.user import User
|
||||
from bot_data.model.user_joined_server import UserJoinedServer
|
||||
from bot_data.model.user_joined_voice_channel import UserJoinedVoiceChannel
|
||||
from modules.stats.model.statistic_result import StatisticResult
|
||||
|
||||
|
||||
async def user_xp_desc(
|
||||
auto_roles: List[AutoRole],
|
||||
clients: List[Client],
|
||||
known_users: List[KnownUser],
|
||||
levels: List[Level],
|
||||
servers: List[Server],
|
||||
user_joined_servers: List[UserJoinedServer],
|
||||
user_joined_voice_channel: List[UserJoinedVoiceChannel],
|
||||
users: List[User],
|
||||
guild: Guild
|
||||
) -> StatisticResult:
|
||||
result = StatisticResult()
|
||||
result.header.append('Name')
|
||||
result.header.append('XP')
|
||||
|
||||
for user in users.order_by_descending(lambda u: u.xp):
|
||||
row = List(str)
|
||||
member = guild.get_member(user.discord_id)
|
||||
row.append(member.name)
|
||||
row.append(str(user.xp))
|
||||
result.values.append(row)
|
||||
|
||||
return result
|
Loading…
Reference in New Issue
Block a user