def add_users(self, client: LINE, group_id: str, mid: str or list, into: str, **kwg) -> bool: """ use this method to insert some user to DataBase @client: class<linepy.LINE.client> @group_id: undefined mid of group as string @mid: undefined mid of user pass string or list @into: pass a specified role for user e.g: blacklist,whitelist whatever you want @kwg: pass another argument as dict :Return: True if success false otherwise """ data = self.db if isinstance(mid, list): u = client.getContacts(mid) for i in u: data.add_users(mid=i.mid, into=into, name=i.displayName, at_group=group_id, globals=True) else: p = client.getContact(mid) data.add_users(mid=p.mid, into=into, name=p.displayName, at_group=group_id, globals=True) return True
def add_admin(self, client: LINE, mid: str or list, **kwg) -> bool: """ Use this method to add Admin to database @client: class<linepy.LINE.Client> @mid: unidefined string of user mid, pass a string or list @kwg: other argument for include to your db e.g: user.displayName pass a dict :Return: True if success false otherwise """ data = self.db if isinstance(mid, list): c = client.getContacts(mid) for i in c: id = i.mid name = i.displayName data.add_admin(id, name=name) else: c = client.getContact(mid) data.add_admin(mid, name=c.displayName) return True