mirror of
https://github.com/zoriya/AnonymousGoose.git
synced 2026-05-28 12:23:20 +00:00
Creating the base of the trick class
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
from trick import Trick
|
||||
|
||||
|
||||
class TestTrick(Trick):
|
||||
def run(self):
|
||||
print("Test succeed")
|
||||
@@ -4,6 +4,7 @@ import pyxhook
|
||||
|
||||
from term_utils import Term
|
||||
from command_helper import CommandHelper
|
||||
from trick import Trick
|
||||
|
||||
|
||||
class AnonymousGoose:
|
||||
@@ -22,11 +23,18 @@ class AnonymousGoose:
|
||||
self.keyboard_listener.cancel()
|
||||
|
||||
def run(self):
|
||||
next_trick_time = 5
|
||||
while not self.should_exit:
|
||||
try:
|
||||
if CommandHelper.run("killall htop") == 0 or CommandHelper.run("killall top") == 0:
|
||||
Term.print_all("You tough that this will be as easy as this?\n")
|
||||
time.sleep(1)
|
||||
next_trick_time -= 1
|
||||
if next_trick_time <= 0:
|
||||
trick = Trick.get_random_trick()
|
||||
next_trick_time = trick.delay
|
||||
trick.run()
|
||||
self.tricks.append(trick)
|
||||
except KeyboardInterrupt:
|
||||
...
|
||||
|
||||
@@ -44,6 +52,27 @@ class AnonymousGoose:
|
||||
if __name__ == "__main__":
|
||||
goose = AnonymousGoose()
|
||||
term = Term()
|
||||
term.print("Test")
|
||||
term.print("""
|
||||
`:-.......``
|
||||
+:o+++:---::
|
||||
`/--::/o/-+s+.
|
||||
`/::/so/:-:-:`
|
||||
`s:----------.
|
||||
/:+oo//soo/o
|
||||
`+o/://///+.
|
||||
/do:-:m--
|
||||
oNNmy-o`
|
||||
`-. `-/sdmNNNNNs`
|
||||
sNNmmNNNNNNNNNNNNd`
|
||||
:NNNNNNNNNNNNNNNNN-
|
||||
-NNNNNNNNNNNNNNNd
|
||||
oNNNNNNNNNNNNNm.
|
||||
+NNNNNNNNNNNN/
|
||||
oNNNNNdssmNd`
|
||||
oNNy- .y`
|
||||
:o .s
|
||||
`s` -sso+/`
|
||||
`ss+:. .-.`
|
||||
.--:.` """"")
|
||||
goose.run()
|
||||
goose.stop()
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import random
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
class Trick(ABC):
|
||||
def __init__(self):
|
||||
self.name = "Undefined"
|
||||
self.delay = 1
|
||||
|
||||
@abstractmethod
|
||||
def run(self):
|
||||
raise NotImplementedError
|
||||
|
||||
@staticmethod
|
||||
def get_random_trick():
|
||||
from Tricks.test import TestTrick
|
||||
tricks = [
|
||||
TestTrick
|
||||
]
|
||||
|
||||
return random.choice(tricks)()
|
||||
Reference in New Issue
Block a user