forked from whisperchan/cursedboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotd.py
203 lines (174 loc) · 8.96 KB
/
motd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
import curses
import random
import time
import re
import npyscreen
MOTD = """
=================.,=====================.,=====================.,=====================.,=====================.
|||||||||||||||| || ||||||||||||||||||| || ||||||||||||||||||| || ||||||||||||||||||| || ||||||||||||||||||| |
----------------.||.-------------------.||.-------------------.||.-------------------.||.-------------------.|
LPME O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM ||
----------------.||.-------------------.||.-------------------.||.-------------------.||.-------------------.|
MMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O WAYQ |||| MMMMMM O MMMMMM |||| 9/11 O MMMMMM ||
----------------.||.-------------------.||.-------------------.||.-------------------.||.-------------------.|
MMMM O MMMMMM |||| BUNKER O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM ||
----------------.||.-------------------.||.-------------------.||.-------------------.||.-------------------.|
MMMM O MMMMMM |||| MMMMMM O CHAN |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O CANADA ||
----------------.||.-------------------.||.-------------------.||.-------------------.||.-------------------.|
MMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| CRYPTO O LOSS |||| MMMMMM O MMMMMM ||
----------------.||.-------------------.||.-------------------.||#####################||.-------------------.|
MMMM O MMMMMM |||| MMMMMM O MMMMMM |||| ALEX O MMMMMM |||# | # | | #||| MMMMMM O MMMMMM ||
----------------.||.-------------------.||.-------------------.||# | # | | #||.-------------------.|
MMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||#####################||| MMMMMM O MMMMMM ||
----------------.||.-------------------.||.-------------------.||# | # | #||.-------------------.|
MMMM O JEWS |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||# | | # | __ #||| MMMMMM O Q-LARP ||
----------------.||.-------------------.||.-------------------.||#####################||.-------------------.|
MMMM O MMMMMM |||| ECHOES O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM ||
----------------.||.-------------------.||.-------------------.||.-------------------.||.-------------------.|
MMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O MMMMMM |||| MMMMMM O JBCS |||| MMMMMM O MMMMMM ||
----------------'||`-------------------'||`-------------------'||`-------------------'||`-------------------'|
=============I===´`=====================´`=====================´`=====================´`=====================´
h or :h for | Alola!~ Welcome to Bunkerchan, have an easy day!
help | Source code can be found here: https://github.com/BigSlice/cursedboard
~~~~~~~~~~~~~´ NEWS: Images enabled! Thank eqi. sftp [email protected] 10 MB limit
"""
line_state = 0
flir = 0
class MotdTextfield(npyscreen.Textfield):
'''Special textfield for animating the motd'''
def __init__(self, *args, **keywords):
super(MotdTextfield, self).__init__(*args, **keywords)
self.syntax_highlighting = True
random.seed(time.time())
def update_highlighting(self, start=None, end=None, clear=False):
global line_state
global flir
value = self.display_value(self.value)
# highlighting color
normal = self.parent.theme_manager.findPair(self, 'DEFAULT')
yellow = self.parent.theme_manager.findPair(self, 'WARNING')
cyan = self.parent.theme_manager.findPair(self, 'STANDOUT')
green = self.parent.theme_manager.findPair(self, 'SAFE')
blue = self.parent.theme_manager.findPair(self, 'NO_EDIT')
red = self.parent.theme_manager.findPair(self, 'DANGER')
color = [normal]*len(value)
if line_state < 14:
if value.find("~~~~~~~~~~~~~´") > -1:
color[line_state] = blue
line_state = (line_state + 1) % 18
elif line_state == 14:
if value.find("| S") > -1:
color[13] = blue
line_state = (line_state + 1) % 18
regex = re.compile("NEWS:")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = random.choice([yellow, cyan, green, red])
regex = re.compile("h or :h for")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("help")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("Alola!~")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = yellow | curses.A_BOLD
regex = re.compile("BUNKER")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = cyan | curses.A_BOLD
regex = re.compile("CHAN")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = cyan | curses.A_BOLD
regex = re.compile("help")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("CRYPTO")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("LOSS")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("ALEX")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("JEWS")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("9/11")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = yellow | curses.A_BOLD
regex = re.compile("WAYQ")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = green | curses.A_BOLD
regex = re.compile("ECHOES")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = cyan | curses.A_BOLD
regex = re.compile("CANADA")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = red | curses.A_BOLD
regex = re.compile("JBCS")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = cyan | curses.A_BOLD
regex = re.compile("MMMMMM")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = random.choice([cyan, normal])
regex = re.compile("#")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = random.choice([red, yellow])
regex = re.compile("MMMM")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
color[i] = random.choice([cyan, normal])
regex = re.compile("O")
for group in regex.finditer(value):
position = group.span()
for i in range(position[0], position[1]):
if line_state == 17:
color[i] = blue
continue
if random.random() > 0.97:
color[i] = red
elif random.random() > 0.95:
color[i] = yellow
else:
color[i] = green
self._highlightingdata = color
class MotdPager(npyscreen.Pager):
''' Pager to display MOTD '''
_contained_widgets = MotdTextfield