Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""LICENSE
2Copyright 2016 Hermann Krumrey <hermann@krumreyh.com>
4This file is part of xdcc-dl.
6xdcc-dl is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
11xdcc-dl is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
16You should have received a copy of the GNU General Public License
17along with xdcc-dl. If not, see <http://www.gnu.org/licenses/>.
18LICENSE"""
20# imports
21import names
22import random
25class User(object):
26 """
27 Models an IRC user
28 """
30 def __init__(self, username: str = "random"):
31 """
32 Initializes the User
34 :param username: the user's username. If left empty, or the string
35 'random' is passed, a random username is generated
36 using the names package.
37 An empty string will also result in a random username
38 """
39 if username == "random" or username == "":
40 self.username = \
41 names.get_first_name() + \
42 names.get_last_name() + \
43 str(random.randint(10, 100))
44 else:
45 self.username = username
47 def get_name(self) -> str:
48 """
49 :return: The user's username
50 """
51 return self.username