mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-11-15 02:21:21 +01:00
Update user chip if a user has been updated
This commit is contained in:
parent
ac956106e9
commit
8b6645306a
@ -1,6 +1,6 @@
|
||||
from titanembeds.utils import socketio, guild_accepts_visitors, get_client_ipaddr
|
||||
from titanembeds.userbookkeeping import check_user_in_guild, get_guild_channels, update_user_status
|
||||
from titanembeds.database import db, GuildMembers
|
||||
from titanembeds.database import db, GuildMembers, get_guild_member
|
||||
from flask_socketio import Namespace, emit, disconnect, join_room, leave_room
|
||||
import functools
|
||||
from flask import request, session
|
||||
@ -78,4 +78,17 @@ class Gateway(Namespace):
|
||||
join_room("CHANNEL_"+chan["channel"]["id"])
|
||||
else:
|
||||
leave_room("CHANNEL_"+chan["channel"]["id"])
|
||||
emit("channel_list", channels)
|
||||
emit("channel_list", channels)
|
||||
|
||||
def on_current_user_info(self, data):
|
||||
guild_id = data["guild_id"]
|
||||
if "user_keys" in session and not session["unauthenticated"]:
|
||||
dbMember = get_guild_member(guild_id, session["user_id"])
|
||||
usr = {
|
||||
'avatar': session["avatar"],
|
||||
'username': dbMember.username,
|
||||
'nickname': dbMember.nickname,
|
||||
'discriminator': dbMember.discriminator,
|
||||
'user_id': session['user_id'],
|
||||
}
|
||||
emit("current_user_info", usr)
|
@ -1052,6 +1052,7 @@
|
||||
|
||||
socket.on("GUILD_MEMBER_UPDATE", function (usr) {
|
||||
update_socket_channels();
|
||||
socket.emit("current_user_info", {"guild_id": guild_id});
|
||||
for (var i = 0; i < discord_users_list.length; i++) {
|
||||
if (usr.id == discord_users_list[i].id) {
|
||||
discord_users_list.splice(i, 1);
|
||||
@ -1116,6 +1117,10 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("current_user_info", function (usr) {
|
||||
update_embed_userchip(true, usr.avatar, usr.username, usr.nickname, usr.userid, usr.discriminator);
|
||||
});
|
||||
}
|
||||
|
||||
function update_socket_channels() {
|
||||
|
Loading…
Reference in New Issue
Block a user