Hide keyboard shortcuts

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 2018 Hermann Krumrey <hermann@krumreyh.com> 

3 

4This file is part of bokkichat. 

5 

6bokkichat 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. 

10 

11bokkichat 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. 

15 

16You should have received a copy of the GNU General Public License 

17along with bokkichat. If not, see <http://www.gnu.org/licenses/>. 

18LICENSE""" 

19 

20from bokkichat.entities.Address import Address 

21 

22 

23class Message: 

24 """ 

25 Class that defines common attributes for a Message object. 

26 """ 

27 

28 def __init__(self, sender: Address, receiver: Address): 

29 """ 

30 Initializes a Message object. 

31 :param sender: The sender of the message 

32 :param receiver: The receiver of the message 

33 """ 

34 self.sender = sender 

35 self.receiver = receiver 

36 

37 def __str__(self) -> str: 

38 """ 

39 :return: A string representation of the Message object 

40 """ 

41 raise NotImplementedError() 

42 

43 def make_reply(self) -> "Message": 

44 """ 

45 Swaps the sender and receiver of the message 

46 :return: The generated reply 

47 """ 

48 raise NotImplementedError() 

49 

50 @staticmethod 

51 def is_text() -> bool: 

52 """ 

53 :return: Whether or not the message is a text message 

54 """ 

55 return False 

56 

57 @staticmethod 

58 def is_media() -> bool: 

59 """ 

60 :return: Whether or not the message is a media message 

61 """ 

62 return False