From 52e58d2da91d2980823612d6c55e41ed6af0382e Mon Sep 17 00:00:00 2001 From: seth Date: Sat, 4 Feb 2023 23:12:58 -0500 Subject: feat: bit of a refactor - moved teawie_bot to root directory - added nix flake --- .envrc | 4 + .gitignore | 4 + .pre-commit-config.yaml | 21 +-- README.md | 2 +- default.nix | 14 ++ flake.lock | 153 ++++++++++++++++ flake.nix | 66 +++++++ pyproject.toml | 302 +------------------------------- src/teawie_bot/__init__.py | 9 - src/teawie_bot/apis/guzzle.py | 20 --- src/teawie_bot/bot.py | 93 ---------- src/teawie_bot/copypastas/__init__.py | 0 src/teawie_bot/copypastas/dvd.txt | 1 - src/teawie_bot/copypastas/egrill.txt | 1 - src/teawie_bot/copypastas/happymeal.txt | 1 - src/teawie_bot/copypastas/ismah.txt | 73 -------- src/teawie_bot/copypastas/navyseal.txt | 1 - src/teawie_bot/copypastas/sus.txt | 1 - src/teawie_bot/copypastas/ticktock.txt | 8 - src/teawie_bot/utils.py | 70 -------- teawie_bot/__init__.py | 9 + teawie_bot/apis/guzzle.py | 20 +++ teawie_bot/bot.py | 93 ++++++++++ teawie_bot/copypastas/__init__.py | 0 teawie_bot/copypastas/dvd.txt | 1 + teawie_bot/copypastas/egrill.txt | 1 + teawie_bot/copypastas/happymeal.txt | 1 + teawie_bot/copypastas/ismah.txt | 73 ++++++++ teawie_bot/copypastas/navyseal.txt | 1 + teawie_bot/copypastas/sus.txt | 1 + teawie_bot/copypastas/ticktock.txt | 8 + teawie_bot/utils.py | 70 ++++++++ 32 files changed, 526 insertions(+), 596 deletions(-) create mode 100644 .envrc mode change 100644 => 120000 .pre-commit-config.yaml create mode 100644 default.nix create mode 100644 flake.lock create mode 100644 flake.nix delete mode 100644 src/teawie_bot/__init__.py delete mode 100644 src/teawie_bot/apis/guzzle.py delete mode 100644 src/teawie_bot/bot.py delete mode 100644 src/teawie_bot/copypastas/__init__.py delete mode 100644 src/teawie_bot/copypastas/dvd.txt delete mode 100644 src/teawie_bot/copypastas/egrill.txt delete mode 100644 src/teawie_bot/copypastas/happymeal.txt delete mode 100644 src/teawie_bot/copypastas/ismah.txt delete mode 100644 src/teawie_bot/copypastas/navyseal.txt delete mode 100644 src/teawie_bot/copypastas/sus.txt delete mode 100644 src/teawie_bot/copypastas/ticktock.txt delete mode 100644 src/teawie_bot/utils.py create mode 100644 teawie_bot/__init__.py create mode 100644 teawie_bot/apis/guzzle.py create mode 100644 teawie_bot/bot.py create mode 100644 teawie_bot/copypastas/__init__.py create mode 100644 teawie_bot/copypastas/dvd.txt create mode 100644 teawie_bot/copypastas/egrill.txt create mode 100644 teawie_bot/copypastas/happymeal.txt create mode 100644 teawie_bot/copypastas/ismah.txt create mode 100644 teawie_bot/copypastas/navyseal.txt create mode 100644 teawie_bot/copypastas/sus.txt create mode 100644 teawie_bot/copypastas/ticktock.txt create mode 100644 teawie_bot/utils.py diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..e31c306 --- /dev/null +++ b/.envrc @@ -0,0 +1,4 @@ +if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs=" +fi +use flake diff --git a/.gitignore b/.gitignore index b6e4761..b1d4722 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,7 @@ dmypy.json # Pyre type checker .pyre/ + +# nix stuff +.direnv/ +result diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index 6e0c147..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -repos: -- repo: https://github.com/pycqa/isort - rev: 5.11.2 - hooks: - - id: isort - name: isort (python) - -- repo: local - hooks: - - id: pylint - name: pylint - entry: pylint - language: system - types: [python] - -- repo: https://github.com/pre-commit/mirrors-yapf - rev: "v0.32.0" # Use the sha / tag you want to point at - hooks: - - id: yapf - additional_dependencies: ["toml"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 120000 index 0000000..9ad99c0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1 @@ +/nix/store/sj4hklv5klfh4wk3pvc8fxd5242qp12q-pre-commit-config.json \ No newline at end of file diff --git a/README.md b/README.md index 8970359..030a8d2 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,6 @@ python -m venv .env source .env/bin/activate # for linux pip install flit -flit install --deps=develop --only-deps +flit install --only-deps pre-commit install ``` diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..c7d0c26 --- /dev/null +++ b/default.nix @@ -0,0 +1,14 @@ +( + import + ( + let + lock = builtins.fromJSON (builtins.readFile ./flake.lock); + in + fetchTarball { + url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; + sha256 = lock.nodes.flake-compat.locked.narHash; + } + ) + {src = ./.;} +) +.defaultNix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..19f48df --- /dev/null +++ b/flake.lock @@ -0,0 +1,153 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1677050843, + "narHash": "sha256-3fcFxn58eCtrXrVPeW/nAg6NR5wUERVEf8zOtjPDzuM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9e0eed654c705c7cafe192a8eba1610217f70544", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1673800717, + "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1676879534, + "narHash": "sha256-HU4RXcwsAX1u7AUbGOBDxkYQkeODcn+HZjXqKa1y/hk=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "c9495f017f67a11e9c9909b032dc7762dfc853cf", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..7ec30ab --- /dev/null +++ b/flake.nix @@ -0,0 +1,66 @@ +{ + description = "teawie moment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + pre-commit-hooks = { + url = "github:cachix/pre-commit-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { + self, + nixpkgs, + pre-commit-hooks, + flake-compat, + flake-utils, + }: let + version = "0.0.1"; + supportedSystems = with flake-utils.lib.system; [x86_64-linux x86_64-darwin aarch64-linux aarch64-darwin]; + in + flake-utils.lib.eachSystem supportedSystems (system: let + pkgs = import nixpkgs {inherit system;}; + in { + packages = + { + teawiebot = with pkgs; + python39Packages.buildPythonPackage { + pname = "teawiebot"; + inherit version; + src = ./.; + format = "flit"; + propagatedBuildInputs = with pkgs.python39Packages; [hatchling discordpy requests]; + }; + } + // {default = self.packages.${system}.teawiebot;}; + + checks = { + pre-commit-check = pre-commit-hooks.lib.${system}.run { + src = ./.; + hooks = { + isort.enable = true; + pylint.enable = true; + yapf = { + enable = true; + name = "yapf"; + entry = "${pkgs.python39Packages.yapf}/bin/yapf -i"; + types = ["file" "python"]; + }; + }; + }; + }; + + devShells = with pkgs; { + default = mkShell { + packages = with pkgs.python39Packages; [python39 discordpy flit pylint requests toml yapf]; + inherit (self.checks.${system}.pre-commit-check) shellHook; + }; + }; + }); +} diff --git a/pyproject.toml b/pyproject.toml index 0d1d1fb..3567aa0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,8 @@ authors = [ readme = "README.md" requires-python = ">=3.8" dependencies = [ - "discord.py >=2.0.0", + "discord.py~=2.0", + "requests~=2.0", ] [project.optional-dependencies] @@ -33,302 +34,9 @@ teawiebot = "teawie_bot:main" [tool.yapf] use_tabs = true -[tool.pylint.main] -# Specify a score threshold under which the program will exit with error. -fail-under = 10 - -# Files or directories to be skipped. They should be base names, not paths. -ignore = ["CVS"] - -# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the -# number of processors available to use, and will cap the count on Windows to -# avoid hangs. -jobs = 1 - -# Control the amount of potential inferred values when inferring a single object. -# This can help the performance when dealing with large functions or complex, -# nested conditions. -limit-inference-results = 100 - -# Pickle collected data for later comparisons. -persistent = true - -# Minimum Python version to use for version dependent checks. Will default to the -# version used to run pylint. -py-version = "3.11" - -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode = true - -[tool.pylint.basic] -# Naming style matching correct argument names. -argument-naming-style = "snake_case" - -# Naming style matching correct attribute names. -attr-naming-style = "snake_case" - -# Bad variable names which should always be refused, separated by a comma. -bad-names = ["foo", "bar", "baz", "toto", "tutu", "tata"] - -# Naming style matching correct class attribute names. -class-attribute-naming-style = "any" - -# Naming style matching correct class constant names. -class-const-naming-style = "UPPER_CASE" - -# Naming style matching correct class names. -class-naming-style = "PascalCase" - -# Naming style matching correct constant names. -const-naming-style = "UPPER_CASE" - -# Minimum line length for functions/classes that require docstrings, shorter ones -# are exempt. -docstring-min-length = -1 - -# Naming style matching correct function names. -function-naming-style = "snake_case" - -# Good variable names which should always be accepted, separated by a comma. -good-names = ["i", "j", "k", "ex", "Run", "_"] - -# Naming style matching correct inline iteration names. -inlinevar-naming-style = "any" - -# Naming style matching correct method names. -method-naming-style = "snake_case" - -# Naming style matching correct module names. -module-naming-style = "snake_case" - -# Regular expression which should only match function or class names that do not -# require a docstring. -no-docstring-rgx = "^_" - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. These -# decorators are taken in consideration only for invalid-name. -property-classes = ["abc.abstractproperty"] - -# Naming style matching correct variable names. -variable-naming-style = "snake_case" - -[tool.pylint.classes] -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods = ["__init__", "__new__", "setUp", "__post_init__"] - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected = ["_asdict", "_fields", "_replace", "_source", "_make"] - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg = ["cls"] - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg = ["cls"] - -[tool.pylint.design] -# Maximum number of arguments for function / method. -max-args = 5 - -# Maximum number of attributes for a class (see R0902). -max-attributes = 7 - -# Maximum number of boolean expressions in an if statement (see R0916). -max-bool-expr = 5 - -# Maximum number of branch for function / method body. -max-branches = 12 - -# Maximum number of locals for function / method body. -max-locals = 15 - -# Maximum number of parents for a class (see R0901). -max-parents = 7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods = 20 - -# Maximum number of return / yield for function / method body. -max-returns = 6 - -# Maximum number of statements in function / method body. -max-statements = 50 - -# Minimum number of public methods for a class (see R0903). -min-public-methods = 2 - -[tool.pylint.exceptions] -# Exceptions that will emit a warning when caught. -overgeneral-exceptions = ["BaseException", "Exception"] - [tool.pylint.format] -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -expected-line-ending-format = "LF" - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines = "^\\s*(# )??$" - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren = 4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string = " " - -# Maximum number of characters on a single line. -max-line-length = 100 - -# Maximum number of lines in a module. -max-module-lines = 1000 - -[tool.pylint.imports] -# Force import order to recognize a module as part of a third party library. -known-third-party = ["enchant"] - -[tool.pylint.logging] -# The type of string formatting that logging methods do. `old` means using % -# formatting, `new` is for `{}` formatting. -logging-format-style = "new" - -# Logging modules to check that the string format arguments are in logging -# function parameter format. -logging-modules = ["logging"] +indent-after-paren = 1 +indent-string = "\t" [tool.pylint."messages control"] -# Only show warnings with the listed confidence levels. Leave empty to show all. -# Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, UNDEFINED. -confidence = ["HIGH", "CONTROL_FLOW", "INFERENCE", "INFERENCE_FAILURE", "UNDEFINED"] - -# Disable the message, report, category or checker with the given id(s). You can -# either give multiple identifiers separated by comma (,) or put this option -# multiple times (only on the command line, not in the configuration file where -# it should appear only once). You can also use "--disable=all" to disable -# everything first and then re-enable specific checks. For example, if you want -# to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use "--disable=all --enable=classes -# --disable=W". -disable = ["raw-checker-failed", "bad-inline-option", "locally-disabled", "file-ignored", "suppressed-message", "useless-suppression", "deprecated-pragma", "use-symbolic-message-instead", "missing-function-docstring", "missing-module-docstring"] - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where it -# should appear only once). See also the "--disable" option for examples. -enable = ["c-extension-no-member"] - -[tool.pylint.method_args] -# List of qualified names (i.e., library.method) which require a timeout -# parameter e.g. 'requests.api.get,requests.api.post' -timeout-methods = ["requests.api.delete", "requests.api.get", "requests.api.head", "requests.api.options", "requests.api.patch", "requests.api.post", "requests.api.put", "requests.api.request"] - -[tool.pylint.miscellaneous] -# List of note tags to take in consideration, separated by a comma. -notes = ["FIXME", "XXX", "TODO"] - -[tool.pylint.refactoring] -# Maximum number of nested blocks for function / method body -max-nested-blocks = 5 - -# Complete name of functions that never returns. When checking for inconsistent- -# return-statements if a never returning function is called then it will be -# considered as an explicit return statement and no message will be printed. -never-returning-functions = ["sys.exit", "argparse.parse_error"] - -[tool.pylint.reports] -# Python expression which should return a score less than or equal to 10. You -# have access to the variables 'fatal', 'error', 'warning', 'refactor', -# 'convention', and 'info' which contain the number of messages in each category, -# as well as 'statement' which is the total number of statements analyzed. This -# score is used by the global evaluation report (RP0004). -evaluation = "max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))" - -# Activate the evaluation score. -score = true - -[tool.pylint.similarities] -# Comments are removed from the similarity computation -ignore-comments = true - -# Docstrings are removed from the similarity computation -ignore-docstrings = true - -# Imports are removed from the similarity computation -ignore-imports = true - -# Signatures are removed from the similarity computation -ignore-signatures = true - -# Minimum lines number of a similarity. -min-similarity-lines = 4 - -[tool.pylint.spelling] -# Limits count of emitted suggestions for spelling mistakes. -max-spelling-suggestions = 4 - -# List of comma separated words that should be considered directives if they -# appear at the beginning of a comment and should not be checked. -spelling-ignore-comment-directives = "fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:" - -[tool.pylint.typecheck] -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators = ["contextlib.contextmanager"] - -# Tells whether missing members accessed in mixin class should be ignored. A -# class is considered mixin if its name matches the mixin-class-rgx option. -# Tells whether to warn about missing members when the owner of the attribute is -# inferred to be None. -ignore-none = true - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference can -# return multiple potential results while evaluating a Python object, but some -# branches might not be evaluated, which results in partial inference. In that -# case, it might be useful to still emit no-member and other checks for the rest -# of the inferred objects. -ignore-on-opaque-inference = true - -# List of symbolic message names to ignore for Mixin members. -ignored-checks-for-mixins = ["no-member", "not-async-context-manager", "not-context-manager", "attribute-defined-outside-init"] - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes = ["optparse.Values", "thread._local", "_thread._local", "argparse.Namespace"] - -# Show a hint with possible names when a member name was not found. The aspect of -# finding the hint is based on edit distance. -missing-member-hint = true - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance = 1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices = 1 - -# Regex pattern to define which classes are considered mixins. -mixin-class-rgx = ".*[Mm]ixin" - -[tool.pylint.variables] -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables = true - -# List of strings which can identify a callback function by name. A callback name -# must start or end with one of those strings. -callbacks = ["cb_", "_cb"] - -# A regular expression matching the name of dummy variables (i.e. expected to not -# be used). -dummy-variables-rgx = "_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_" - -# Argument names that match this expression will be ignored. -ignored-argument-names = "_.*|^ignored_|^unused_" - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules = ["six.moves", "past.builtins", "future.builtins", "builtins", "io"] +disable = ["missing-function-docstring", "missing-module-docstring"] diff --git a/src/teawie_bot/__init__.py b/src/teawie_bot/__init__.py deleted file mode 100644 index e3b5d8f..0000000 --- a/src/teawie_bot/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -import os - -from .bot import bot - -TOKEN = os.getenv("TOKEN") - - -def main(): - bot.run(TOKEN) diff --git a/src/teawie_bot/apis/guzzle.py b/src/teawie_bot/apis/guzzle.py deleted file mode 100644 index 7599606..0000000 --- a/src/teawie_bot/apis/guzzle.py +++ /dev/null @@ -1,20 +0,0 @@ -import requests - -GUZZLE: str = "https://guzzle.gay/api" - - -def get_random_teawie() -> str: - resp: requests.Response - try: - resp = requests.get(GUZZLE + "/get_random_teawie", timeout=30) - except (requests.RequestException, requests.ConnectionError, - requests.HTTPError, requests.JSONDecodeError): - return "something went wrong :(" - if not resp.status_code == 200: - return "api request failed :(" - - try: - ret = resp.json()["url"] - except KeyError: - return "couldn't get url from api response :(" - return ret diff --git a/src/teawie_bot/bot.py b/src/teawie_bot/bot.py deleted file mode 100644 index 835783a..0000000 --- a/src/teawie_bot/bot.py +++ /dev/null @@ -1,93 +0,0 @@ -import discord -from discord import app_commands -from discord.ext import commands - -from teawie_bot import utils -from teawie_bot.apis import guzzle - -SERVER_ID = discord.Object(id=1055663552679137310) -intents = discord.Intents.default() -intents.message_content = True # pylint: disable=assigning-non-slot -bot = commands.Bot(command_prefix="t!", - description="teawie time", - intents=intents) - - -@bot.event -async def on_ready(): - print(f"logged in as {bot.user}") - await bot.tree.sync(guild=SERVER_ID) - bot.teawies = utils.Teawies(bot) - print("ready!") - - -@bot.event -async def on_message(message: discord.Message): - if message.author == bot.user: - return - - echo_messages = [ - "๐Ÿ—ฟ", - ] - echo_messages = echo_messages + bot.teawies.emojis - try: - index = echo_messages.index(message.content.lower()) - await message.channel.send(echo_messages[index]) - except ValueError: - pass - - await bot.process_commands(message) - - -@bot.command() -async def ask(ctx: commands.Context): - await ctx.send(utils.get_random_response(bot)) - - -@bot.tree.command( - name="ask", - description="ask lord teawie a question and they shall respond", - guild=SERVER_ID) -async def ask_slash_command(interaction: discord.Interaction, question: str): # pylint: disable=unused-argument - msg = utils.get_random_response(bot) - await interaction.response.send_message(msg) - - -@bot.command() -async def teawiespam(ctx: commands.Context): - emoji = str(discord.utils.get(bot.emojis, name="teawiesmile")) - msg = str() - for _ in range(50): - msg += emoji - - await ctx.send(msg) - - -@bot.tree.command(name="copypasta", - description="send funni copypasta", - guild=SERVER_ID) -@app_commands.choices(choices=[ - app_commands.Choice(name="happymeal", value="happymeal"), - app_commands.Choice(name="ismah", value="ismah"), - app_commands.Choice(name="sus", value="sus"), - app_commands.Choice(name="ticktock", value="ticktock"), - app_commands.Choice(name="amongus_sus", value="amongus_sus"), - app_commands.Choice(name="egrill", value="egrill"), - app_commands.Choice(name="dvd", value="dvd"), -]) -async def copypasta(interaction: discord.Interaction, - choices: app_commands.Choice[str]): - msgs = utils.get_copypasta(choices.value) - for i, msg in enumerate(msgs): - if i == 0: - await interaction.response.send_message(msg) - else: - await interaction.channel.send(msg) - - -@bot.tree.command(name="random_teawie", - description="get a random teawie!", - guild=SERVER_ID) -async def random_teawie(interaction: discord.Interaction): - msg = guzzle.get_random_teawie() - await interaction.response.send_message(msg) diff --git a/src/teawie_bot/copypastas/__init__.py b/src/teawie_bot/copypastas/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/teawie_bot/copypastas/dvd.txt b/src/teawie_bot/copypastas/dvd.txt deleted file mode 100644 index 4c4e848..0000000 --- a/src/teawie_bot/copypastas/dvd.txt +++ /dev/null @@ -1 +0,0 @@ -Earlier today I was really horny, and I saw what I thought to be a blank DVD. I thought, DVDs have a tight hole, they might feel pretty good. So I put my soft pp into the hole of the DVD, and for a few seconds as I started getting harder, it felt pretty good, but then, once I was fully erect, it started being painful. My pp was stuck in the DVD, and I had to break it in half to get if out. It was then when I flipped the broken DVD over and realized that it was not a blank DVD, but a copy of the Pixar movie Up.. Well guys, guess I fucked up. \ No newline at end of file diff --git a/src/teawie_bot/copypastas/egrill.txt b/src/teawie_bot/copypastas/egrill.txt deleted file mode 100644 index d97e8ae..0000000 --- a/src/teawie_bot/copypastas/egrill.txt +++ /dev/null @@ -1 +0,0 @@ -So the other day, I was playing rainbow six siege, and I heard one of my teammates make a callout in the voice chat. It was a real life gamer girl. God, I kid you not, I just stopped playing and pulled my dick out. โ€œfuck, Fuck!โ€ I was yelling in voice chat. I just wanted to hear her voice again. โ€œPlease,โ€ I moaned. But she left the lobby. I was crying and covered in my own cum, but I remembered that I could find recent teammates in the ubiplay friends tab. I frantically closed down siege and opened the tab, to find out she had TTV IN HER NAME!!! She was streaming, and only had 100 viewers!!! The competition was low, so I made the first move and donated my months rent to her. I was already about to pre. She read my donation in the chat. God this is the happiest Iโ€™ve been in a long time. I did a little research, and found out where she goes to school, but I am a little nervous to talk to her in person, and need support. Any advice before my Uber gets to her middle school? \ No newline at end of file diff --git a/src/teawie_bot/copypastas/happymeal.txt b/src/teawie_bot/copypastas/happymeal.txt deleted file mode 100644 index a186e78..0000000 --- a/src/teawie_bot/copypastas/happymeal.txt +++ /dev/null @@ -1 +0,0 @@ -OH MY GOD ITS 3 IN THE MORNING AND IM IN MCDONALDS AND WE JUST FOUND OUT THAT WHEN U PULL UP IN MCDONALDS AT 3 AM YOU CAN BUY THE AMONG US HAPPY MEAL WITH A TOY IN IT WHICH IS EITHER THE IMPOSTOR OR THE CREWMATE AND IF YOU DONT KNOW WHAT AMONG US IS YOU MUST BE MUST REALLY BE LIVING UNDER A ROCK ITS AN AWESOME GAME WITH IMPOSTORS AND CREWMATES AND BASICALLY THE IMPOSTOR TRIES TO SABOTAGE THE WHOLE GAME AND THE CREWMATES NEED TO STOP HIM BUT APPARENTLY WHEN YOU PURCHASE THE AMONG US HAPPY MEAL SOMETHING SCARY HAPPENS \ No newline at end of file diff --git a/src/teawie_bot/copypastas/ismah.txt b/src/teawie_bot/copypastas/ismah.txt deleted file mode 100644 index 8d3a87f..0000000 --- a/src/teawie_bot/copypastas/ismah.txt +++ /dev/null @@ -1,73 +0,0 @@ - -As an enlightened, modern parent, I try to be as involved as possible in the lives of my six children. I encourage them to join team sports. I attend their teen parties with them to ensure no drinking or alcohol is on the premises. I keep a fatherly eye on the CDs they listen to and the shows they watch, the company they keep and the books they read. You could say I'm a model parent. My children have never failed to make me proud, and I can say without the slightest embellishment that I have the finest family in the USA. -Two years ago, my wife Carol and I decided that our children's education would not be complete without some grounding in modern computers. To this end, we bought our children a brand new Compaq to learn with. The kids had a lot of fun using the handful of application programs we'd bought, such as Adobe's Photoshop and Microsoft's Word, and my wife and I were pleased that our gift was received so well. Our son Peter was most entranced by the device, and became quite a pro at surfing the net. When Peter began to spend whole days on the machine, I became concerned, but Carol advised me to calm down, and that it was only a passing phase. I was content to bow to her experience as a mother, until our youngest daughter, Cindy, charged into the living room one night to blurt out: "Peter is a computer hacker!" - - -As you can imagine, I was amazed. A computer hacker in my own house! I began to monitor my son's habits, to make certain that Cindy wasn't just telling stories, as she is prone to doing at times. - -After a few days of investigation, and some research into computer hacking, I confronted Peter with the evidence. I'm afraid to say, this was the only time I have ever been truly disappointed in one of my children. We raised them to be honest and to have integrity, and Peter betrayed the principles we tried to encourage in him, when he refused point blank to admit to his activities. His denials continued for hours, and in the end, I was left with no choice but to ban him from using the computer until he is old enough to be responsible for his actions. - -After going through this ordeal with my own family, I was left pondering how I could best help others in similar situations. I'd gained a lot of knowledge over those few days regarding hackers. It's only right that I provide that information to other parents, in the hope that they will be able to tell if their children are being drawn into the world of hacking. Perhaps other parents will be able to steer their sons back onto the straight and narrow before extreme measures need to be employed. - -To this end, I have decided to publish the top ten signs that your son is a hacker. I advise any parents to read this list carefully and if their son matches the profile, they should take action. A smart parent will first try to reason with their son, before resorting to groundings, or even spanking. I pride myself that I have never had to spank a child, and I hope this guide will help other parents to put a halt to their son's misbehaviour before a spanking becomes necessary. - -1. Has your son asked you to change ISPs? - - Most American families use trusted and responsible Internet Service Providers, such as AOL. These providers have a strict "No Hacking" policy, and take careful measures to ensure that your internet experience is enjoyable, educational and above all legal. If your child is becoming a hacker, one of his first steps will be to request a change to a more hacker friendly provider. - - I would advise all parents to refuse this request. One of the reasons your son is interested in switching providers is to get away from AOL's child safety filter. This filter is vital to any parent who wants his son to enjoy the internet without the endangering him through exposure to "adult" content. It is best to stick with the protection AOL provides, rather than using a home-based solution. If your son is becoming a hacker, he will be able to circumvent any home-based measures with surprising ease, using information gleaned from various hacker sites. - -2. Are you finding programs on your computer that you don't remember installing? - - Your son will probably try to install some hacker software. He may attempt to conceal the presence of the software in some way, but you can usually find any new programs by reading through the programs listed under "Install/Remove Programs" in your control panel. Popular hacker software includes "Comet Cursor", "Bonzi Buddy" and "Flash" . - - The best option is to confront your son with the evidence, and force him to remove the offending programs. He will probably try to install the software again, but you will be able to tell that this is happening, if your machine offers to "download" one of the hacker applications. If this happens, it is time to give your son a stern talking to, and possibly consider punishing him with a grounding. - -3. Has your child asked for new hardware? - - Computer hackers are often limited by conventional computer hardware. They may request "faster" video cards, and larger hard drives, or even more memory. If your son starts requesting these devices, it is possible that he has a legitimate need. You can best ensure that you are buying legal, trustworthy hardware by only buying replacement parts from your computer's manufacturer. - - If your son has requested a new "processor" from a company called "AMD", this is genuine cause for alarm. AMD is a third-world based company who make inferior, "knock-off" copies of American processor chips. They use child labor extensively in their third world sweatshops, and they deliberately disable the security features that American processor makers, such as Intel, use to prevent hacking. AMD chips are never sold in stores, and you will most likely be told that you have to order them from internet sites. Do not buy this chip! This is one request that you must refuse your son, if you are to have any hope of raising him well. - -4. Does your child read hacking manuals? - - If you pay close attention to your son's reading habits, as I do, you will be able to determine a great deal about his opinions and hobbies. Children are at their most impressionable in the teenage years. Any father who has had a seventeen year old daughter attempt to sneak out on a date wearing make up and perfume is well aware of the effect that improper influences can have on inexperienced minds. - - There are, unfortunately, many hacking manuals available in bookshops today. A few titles to be on the lookout for are: "Snow Crash" and "Cryptonomicon" by Neal Stephenson; "Neuromancer" by William Gibson; "Programming with Perl" by Timothy O'Reilly; "Geeks" by Jon Katz; "The Hacker Crackdown" by Bruce Sterling; "Microserfs" by Douglas Coupland; "Hackers" by Steven Levy; and "The Cathedral and the Bazaar" by Eric S. Raymond. - - If you find any of these hacking manuals in your child's possession, confiscate them immediately. You should also petition local booksellers to remove these titles from their shelves. You may meet with some resistance at first, but even booksellers have to bow to community pressure. - -5. How much time does your child spend using the computer each day? - - If your son spends more than thirty minutes each day on the computer, he may be using it to DOS other peoples sites. DOSing involves gaining access to the "command prompt" on other people's machines, and using it to tie up vital internet services. This can take up to eight hours. If your son is doing this, he is breaking the law, and you should stop him immediately. The safest policy is to limit your children's access to the computer to a maximum of forty-five minutes each day. - -6. Does your son use Quake? - - Quake is an online virtual reality used by hackers. It is a popular meeting place and training ground, where they discuss hacking and train in the use of various firearms. Many hackers develop anti-social tendencies due to the use of this virtual world, and it may cause erratic behaviour at home and at school. - - If your son is using Quake, you should make hime understand that this is not acceptable to you. You should ensure all the firearms in your house are carefully locked away, and have trigger locks installed. You should also bring your concerns to the attention of his school. - -7. Is your son becoming argumentative and surly in his social behaviour? - - As a child enters the electronic world of hacking, he may become disaffected with the real world. He may lose the ability to control his actions, or judge the rightness or wrongness of a course of behaviour. This will manifest itself soonest in the way he treats others. Those whom he disagrees with will be met with scorn, bitterness, and even foul language. He may utter threats of violence of a real or electronic nature. - - Even when confronted, your son will probably find it difficult to talk about this problem to you. He will probably claim that there is no problem, and that you are imagining things. He may tell you that it is you who has the problem, and you should "back off" and "stop smothering him." Do not allow yourself to be deceived. You are the only chance your son has, even if he doesn't understand the situation he is in. Keep trying to get through to him, no matter how much he retreats into himself. - -8. Is your son obsessed with "Lunix"? - - BSD, Lunix, Debian and Mandrake are all versions of an illegal hacker operation system, invented by a Soviet computer hacker named Linyos Torovoltos, before the Russians lost the Cold War. It is based on a program called "xenix", which was written by Microsoft for the US government. These programs are used by hackers to break into other people's computer systems to steal credit card numbers. They may also be used to break into people's stereos to steal their music, using the "mp3" program. Torovoltos is a notorious hacker, responsible for writing many hacker programs, such as "telnet", which is used by hackers to connect to machines on the internet without using a telephone. - - Your son may try to install "lunix" on your hard drive. If he is careful, you may not notice its presence, however, lunix is a capricious beast, and if handled incorrectly, your son may damage your computer, and even break it completely by deleting Windows, at which point you will have to have your computer repaired by a professional. - - If you see the word "LILO" during your windows startup (just after you turn the machine on), your son has installed lunix. In order to get rid of it, you will have to send your computer back to the manufacturer, and have them fit a new hard drive. Lunix is extremely dangerous software, and cannot be removed without destroying part of your hard disk surface. - -9. Has your son radically changed his appearance? - - If your son has undergone a sudden change in his style of dress, you may have a hacker on your hands. Hackers tend to dress in bright, day-glo colors. They may wear baggy pants, bright colored shirts and spiky hair dyed in bright colors to match their clothes. They may take to carrying "glow-sticks" and some wear pacifiers around their necks. (I have no idea why they do this) There are many such hackers in schools today, and your son may have started to associate with them. If you notice that your son's group of friends includes people dressed like this, it is time to think about a severe curfew, to protect him from dangerous influences. - -10. Is your son struggling academically? - - If your son is failing courses in school, or performing poorly on sports teams, he may be involved in a hacking group, such as the infamous "Otaku" hacker association. Excessive time spent on the computer, communicating with his fellow hackers may cause temporary damage to the eyes and brain, from the electromagnetic radiation. This will cause his marks to slip dramatically, particularly in difficult subjects such as Math, and Chemistry. In extreme cases, over-exposure to computer radiation can cause schizophrenia, meningitis and other psychological diseases. Also, the reduction in exercise may cause him to lose muscle mass, and even to start gaining weight. For the sake of your child's mental and physical health, you must put a stop to his hacking, and limit his computer time drastically. - - -I encourage all parents to read through this guide carefully. Your child's future may depend upon it. Hacking is an illegal and dangerous activity, that may land your child in prison, and tear your family apart. It cannot be taken too seriously. diff --git a/src/teawie_bot/copypastas/navyseal.txt b/src/teawie_bot/copypastas/navyseal.txt deleted file mode 100644 index cb8eb67..0000000 --- a/src/teawie_bot/copypastas/navyseal.txt +++ /dev/null @@ -1 +0,0 @@ -What the fuck did you just fucking say about me, you little bitch? Iโ€™ll have you know I graduated top of my class in the Navy Seals, and Iโ€™ve been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and Iโ€™m the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. Youโ€™re fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and thatโ€™s just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little โ€œcleverโ€ comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldnโ€™t, you didnโ€™t, and now youโ€™re paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. Youโ€™re fucking dead, kiddo. \ No newline at end of file diff --git a/src/teawie_bot/copypastas/sus.txt b/src/teawie_bot/copypastas/sus.txt deleted file mode 100644 index a381e3e..0000000 --- a/src/teawie_bot/copypastas/sus.txt +++ /dev/null @@ -1 +0,0 @@ -HOLY SHIT DID YOU JUST SAY THE WORD SUS???๐Ÿ˜ณ1?/1๐Ÿ˜ฑ//1๐Ÿ˜ณ/1111!!!! Wait, you don't know what it is from?๐Ÿ˜ณ๐Ÿ˜ณ๐Ÿ˜ณLet ๐Ÿ‘†give you a brief r/history. ๐Ÿ“š๐Ÿ“š๐Ÿ“š๐Ÿ‘จโ€๐Ÿš€If you didn't r/knowyourshit, the r/term sus(suspicious) is a saying from the r/popular r/game r/AmongUs. Among us is so fun๐Ÿ˜” ๐Ÿ‘‰๐Ÿ‘ˆ, don't insult it, every youtuber and streamer says so!!!!!!!11 Corpses voice is so deep am i right or am i right๐Ÿ˜ณ๐Ÿ˜ณ????? I mean Mr beast and Dream play and pull big ๐Ÿง  1000000000000 iq moves in their videos..... YOU WERE THE IMPOSTER.... เถž เถž เถž Get it because you don't know what sus means? r/stupidquestions r/youranidot r/stupidcuck. I CAnT BELEeVE YOUU dont KNoW WHT SUS MeaNS?/??!??!?!!๐Ÿ–•๐Ÿ–•๐Ÿ–•๐Ÿ–•๐Ÿ–• Man why do i have to r/explain this to a r/idiot๐Ÿคช๐Ÿคช๐Ÿคช๐Ÿ“š๐Ÿ“š๐Ÿ“š... Sus is a GREAT WORD from a GREAT VIDEO GAME. in class, YOU CAN PLAY IT ON YOUR PHONE๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ??!?!? such a masterpiece... FOR THE GREAT PRICE OF FREE!!!11!๐Ÿ’ฐ๐Ÿ’ฐ๐Ÿค‘๐Ÿค‘๐Ÿค‘๐Ÿค‘๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ’ฐ๐Ÿ’ฐ It can also mean gay ๐Ÿ˜ณ๐Ÿ˜ณ๐Ÿ˜ณ๐Ÿ˜ณ \ No newline at end of file diff --git a/src/teawie_bot/copypastas/ticktock.txt b/src/teawie_bot/copypastas/ticktock.txt deleted file mode 100644 index 22beb4a..0000000 --- a/src/teawie_bot/copypastas/ticktock.txt +++ /dev/null @@ -1,8 +0,0 @@ -Tick-tock -Heavy like a Brinks truck -Looking like I'm tip-top -Shining like a wristwatch -Time will grab your wrist -Lock it down 'til the thing pop -Can you stick around for a minute 'til the ring stop? -Please, God \ No newline at end of file diff --git a/src/teawie_bot/utils.py b/src/teawie_bot/utils.py deleted file mode 100644 index c75135b..0000000 --- a/src/teawie_bot/utils.py +++ /dev/null @@ -1,70 +0,0 @@ -import importlib.resources -import random -from math import ceil - -import discord -from discord.ext import commands - -from teawie_bot import copypastas - -CHAR_LIMIT: int = 2000 - - -# pylint: disable-next=too-few-public-methods -class Teawies: - """ - wrapper class around list[discord.Emoji] - """ - - def __init__(self, bot: commands.Bot): - names = [ - "teawiecry", "teawiederp", "teawiedizzy", - "teawienerdcroppedanddownsized", "teawieneutral", "teawiepet", - "teawiepetfast", "teawiepop", "teawiesmile", "teawiesmug", - "teawiestarstruck", "tei", "wavy", "wie", "manythoughtsheadfull" - ] - - self.emojis: list[str] = [ - str(discord.utils.get(bot.emojis, name=name)) for name in names - ] - - def random(self) -> str: - return random.choice(self.emojis) - - -def get_random_response(bot: commands.Bot) -> str: - responses = [ - "soon", - "maybe", - "perhaps", - "elaborate", - str(discord.utils.get(bot.emojis, name="moyai")), - ] - responses = responses + bot.teawies.emojis - return random.choice(responses) - - -def split_msg(msg: str) -> list[str]: - """ - splits a message into multiple parts so that it - can fit into the discord character limit - """ - split = ceil(len(msg) / ceil(len(msg) / CHAR_LIMIT)) - return [msg[i:i + split] for i in range(0, len(msg), split)] - - -def get_copypasta(name: str) -> list[str]: - try: - res = importlib.resources.read_text(copypastas, name + ".txt") - except OSError: - return ["something went wrong :("] - - if res == "": - return [f"couldn't send copypasta: {name} :("] - - if len(res) >= CHAR_LIMIT: - res = split_msg(res) - else: - res = [res] - - return res diff --git a/teawie_bot/__init__.py b/teawie_bot/__init__.py new file mode 100644 index 0000000..e3b5d8f --- /dev/null +++ b/teawie_bot/__init__.py @@ -0,0 +1,9 @@ +import os + +from .bot import bot + +TOKEN = os.getenv("TOKEN") + + +def main(): + bot.run(TOKEN) diff --git a/teawie_bot/apis/guzzle.py b/teawie_bot/apis/guzzle.py new file mode 100644 index 0000000..7599606 --- /dev/null +++ b/teawie_bot/apis/guzzle.py @@ -0,0 +1,20 @@ +import requests + +GUZZLE: str = "https://guzzle.gay/api" + + +def get_random_teawie() -> str: + resp: requests.Response + try: + resp = requests.get(GUZZLE + "/get_random_teawie", timeout=30) + except (requests.RequestException, requests.ConnectionError, + requests.HTTPError, requests.JSONDecodeError): + return "something went wrong :(" + if not resp.status_code == 200: + return "api request failed :(" + + try: + ret = resp.json()["url"] + except KeyError: + return "couldn't get url from api response :(" + return ret diff --git a/teawie_bot/bot.py b/teawie_bot/bot.py new file mode 100644 index 0000000..835783a --- /dev/null +++ b/teawie_bot/bot.py @@ -0,0 +1,93 @@ +import discord +from discord import app_commands +from discord.ext import commands + +from teawie_bot import utils +from teawie_bot.apis import guzzle + +SERVER_ID = discord.Object(id=1055663552679137310) +intents = discord.Intents.default() +intents.message_content = True # pylint: disable=assigning-non-slot +bot = commands.Bot(command_prefix="t!", + description="teawie time", + intents=intents) + + +@bot.event +async def on_ready(): + print(f"logged in as {bot.user}") + await bot.tree.sync(guild=SERVER_ID) + bot.teawies = utils.Teawies(bot) + print("ready!") + + +@bot.event +async def on_message(message: discord.Message): + if message.author == bot.user: + return + + echo_messages = [ + "๐Ÿ—ฟ", + ] + echo_messages = echo_messages + bot.teawies.emojis + try: + index = echo_messages.index(message.content.lower()) + await message.channel.send(echo_messages[index]) + except ValueError: + pass + + await bot.process_commands(message) + + +@bot.command() +async def ask(ctx: commands.Context): + await ctx.send(utils.get_random_response(bot)) + + +@bot.tree.command( + name="ask", + description="ask lord teawie a question and they shall respond", + guild=SERVER_ID) +async def ask_slash_command(interaction: discord.Interaction, question: str): # pylint: disable=unused-argument + msg = utils.get_random_response(bot) + await interaction.response.send_message(msg) + + +@bot.command() +async def teawiespam(ctx: commands.Context): + emoji = str(discord.utils.get(bot.emojis, name="teawiesmile")) + msg = str() + for _ in range(50): + msg += emoji + + await ctx.send(msg) + + +@bot.tree.command(name="copypasta", + description="send funni copypasta", + guild=SERVER_ID) +@app_commands.choices(choices=[ + app_commands.Choice(name="happymeal", value="happymeal"), + app_commands.Choice(name="ismah", value="ismah"), + app_commands.Choice(name="sus", value="sus"), + app_commands.Choice(name="ticktock", value="ticktock"), + app_commands.Choice(name="amongus_sus", value="amongus_sus"), + app_commands.Choice(name="egrill", value="egrill"), + app_commands.Choice(name="dvd", value="dvd"), +]) +async def copypasta(interaction: discord.Interaction, + choices: app_commands.Choice[str]): + msgs = utils.get_copypasta(choices.value) + for i, msg in enumerate(msgs): + if i == 0: + await interaction.response.send_message(msg) + else: + await interaction.channel.send(msg) + + +@bot.tree.command(name="random_teawie", + description="get a random teawie!", + guild=SERVER_ID) +async def random_teawie(interaction: discord.Interaction): + msg = guzzle.get_random_teawie() + await interaction.response.send_message(msg) diff --git a/teawie_bot/copypastas/__init__.py b/teawie_bot/copypastas/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/teawie_bot/copypastas/dvd.txt b/teawie_bot/copypastas/dvd.txt new file mode 100644 index 0000000..4c4e848 --- /dev/null +++ b/teawie_bot/copypastas/dvd.txt @@ -0,0 +1 @@ +Earlier today I was really horny, and I saw what I thought to be a blank DVD. I thought, DVDs have a tight hole, they might feel pretty good. So I put my soft pp into the hole of the DVD, and for a few seconds as I started getting harder, it felt pretty good, but then, once I was fully erect, it started being painful. My pp was stuck in the DVD, and I had to break it in half to get if out. It was then when I flipped the broken DVD over and realized that it was not a blank DVD, but a copy of the Pixar movie Up.. Well guys, guess I fucked up. \ No newline at end of file diff --git a/teawie_bot/copypastas/egrill.txt b/teawie_bot/copypastas/egrill.txt new file mode 100644 index 0000000..d97e8ae --- /dev/null +++ b/teawie_bot/copypastas/egrill.txt @@ -0,0 +1 @@ +So the other day, I was playing rainbow six siege, and I heard one of my teammates make a callout in the voice chat. It was a real life gamer girl. God, I kid you not, I just stopped playing and pulled my dick out. โ€œfuck, Fuck!โ€ I was yelling in voice chat. I just wanted to hear her voice again. โ€œPlease,โ€ I moaned. But she left the lobby. I was crying and covered in my own cum, but I remembered that I could find recent teammates in the ubiplay friends tab. I frantically closed down siege and opened the tab, to find out she had TTV IN HER NAME!!! She was streaming, and only had 100 viewers!!! The competition was low, so I made the first move and donated my months rent to her. I was already about to pre. She read my donation in the chat. God this is the happiest Iโ€™ve been in a long time. I did a little research, and found out where she goes to school, but I am a little nervous to talk to her in person, and need support. Any advice before my Uber gets to her middle school? \ No newline at end of file diff --git a/teawie_bot/copypastas/happymeal.txt b/teawie_bot/copypastas/happymeal.txt new file mode 100644 index 0000000..a186e78 --- /dev/null +++ b/teawie_bot/copypastas/happymeal.txt @@ -0,0 +1 @@ +OH MY GOD ITS 3 IN THE MORNING AND IM IN MCDONALDS AND WE JUST FOUND OUT THAT WHEN U PULL UP IN MCDONALDS AT 3 AM YOU CAN BUY THE AMONG US HAPPY MEAL WITH A TOY IN IT WHICH IS EITHER THE IMPOSTOR OR THE CREWMATE AND IF YOU DONT KNOW WHAT AMONG US IS YOU MUST BE MUST REALLY BE LIVING UNDER A ROCK ITS AN AWESOME GAME WITH IMPOSTORS AND CREWMATES AND BASICALLY THE IMPOSTOR TRIES TO SABOTAGE THE WHOLE GAME AND THE CREWMATES NEED TO STOP HIM BUT APPARENTLY WHEN YOU PURCHASE THE AMONG US HAPPY MEAL SOMETHING SCARY HAPPENS \ No newline at end of file diff --git a/teawie_bot/copypastas/ismah.txt b/teawie_bot/copypastas/ismah.txt new file mode 100644 index 0000000..8d3a87f --- /dev/null +++ b/teawie_bot/copypastas/ismah.txt @@ -0,0 +1,73 @@ + +As an enlightened, modern parent, I try to be as involved as possible in the lives of my six children. I encourage them to join team sports. I attend their teen parties with them to ensure no drinking or alcohol is on the premises. I keep a fatherly eye on the CDs they listen to and the shows they watch, the company they keep and the books they read. You could say I'm a model parent. My children have never failed to make me proud, and I can say without the slightest embellishment that I have the finest family in the USA. +Two years ago, my wife Carol and I decided that our children's education would not be complete without some grounding in modern computers. To this end, we bought our children a brand new Compaq to learn with. The kids had a lot of fun using the handful of application programs we'd bought, such as Adobe's Photoshop and Microsoft's Word, and my wife and I were pleased that our gift was received so well. Our son Peter was most entranced by the device, and became quite a pro at surfing the net. When Peter began to spend whole days on the machine, I became concerned, but Carol advised me to calm down, and that it was only a passing phase. I was content to bow to her experience as a mother, until our youngest daughter, Cindy, charged into the living room one night to blurt out: "Peter is a computer hacker!" + + +As you can imagine, I was amazed. A computer hacker in my own house! I began to monitor my son's habits, to make certain that Cindy wasn't just telling stories, as she is prone to doing at times. + +After a few days of investigation, and some research into computer hacking, I confronted Peter with the evidence. I'm afraid to say, this was the only time I have ever been truly disappointed in one of my children. We raised them to be honest and to have integrity, and Peter betrayed the principles we tried to encourage in him, when he refused point blank to admit to his activities. His denials continued for hours, and in the end, I was left with no choice but to ban him from using the computer until he is old enough to be responsible for his actions. + +After going through this ordeal with my own family, I was left pondering how I could best help others in similar situations. I'd gained a lot of knowledge over those few days regarding hackers. It's only right that I provide that information to other parents, in the hope that they will be able to tell if their children are being drawn into the world of hacking. Perhaps other parents will be able to steer their sons back onto the straight and narrow before extreme measures need to be employed. + +To this end, I have decided to publish the top ten signs that your son is a hacker. I advise any parents to read this list carefully and if their son matches the profile, they should take action. A smart parent will first try to reason with their son, before resorting to groundings, or even spanking. I pride myself that I have never had to spank a child, and I hope this guide will help other parents to put a halt to their son's misbehaviour before a spanking becomes necessary. + +1. Has your son asked you to change ISPs? + + Most American families use trusted and responsible Internet Service Providers, such as AOL. These providers have a strict "No Hacking" policy, and take careful measures to ensure that your internet experience is enjoyable, educational and above all legal. If your child is becoming a hacker, one of his first steps will be to request a change to a more hacker friendly provider. + + I would advise all parents to refuse this request. One of the reasons your son is interested in switching providers is to get away from AOL's child safety filter. This filter is vital to any parent who wants his son to enjoy the internet without the endangering him through exposure to "adult" content. It is best to stick with the protection AOL provides, rather than using a home-based solution. If your son is becoming a hacker, he will be able to circumvent any home-based measures with surprising ease, using information gleaned from various hacker sites. + +2. Are you finding programs on your computer that you don't remember installing? + + Your son will probably try to install some hacker software. He may attempt to conceal the presence of the software in some way, but you can usually find any new programs by reading through the programs listed under "Install/Remove Programs" in your control panel. Popular hacker software includes "Comet Cursor", "Bonzi Buddy" and "Flash" . + + The best option is to confront your son with the evidence, and force him to remove the offending programs. He will probably try to install the software again, but you will be able to tell that this is happening, if your machine offers to "download" one of the hacker applications. If this happens, it is time to give your son a stern talking to, and possibly consider punishing him with a grounding. + +3. Has your child asked for new hardware? + + Computer hackers are often limited by conventional computer hardware. They may request "faster" video cards, and larger hard drives, or even more memory. If your son starts requesting these devices, it is possible that he has a legitimate need. You can best ensure that you are buying legal, trustworthy hardware by only buying replacement parts from your computer's manufacturer. + + If your son has requested a new "processor" from a company called "AMD", this is genuine cause for alarm. AMD is a third-world based company who make inferior, "knock-off" copies of American processor chips. They use child labor extensively in their third world sweatshops, and they deliberately disable the security features that American processor makers, such as Intel, use to prevent hacking. AMD chips are never sold in stores, and you will most likely be told that you have to order them from internet sites. Do not buy this chip! This is one request that you must refuse your son, if you are to have any hope of raising him well. + +4. Does your child read hacking manuals? + + If you pay close attention to your son's reading habits, as I do, you will be able to determine a great deal about his opinions and hobbies. Children are at their most impressionable in the teenage years. Any father who has had a seventeen year old daughter attempt to sneak out on a date wearing make up and perfume is well aware of the effect that improper influences can have on inexperienced minds. + + There are, unfortunately, many hacking manuals available in bookshops today. A few titles to be on the lookout for are: "Snow Crash" and "Cryptonomicon" by Neal Stephenson; "Neuromancer" by William Gibson; "Programming with Perl" by Timothy O'Reilly; "Geeks" by Jon Katz; "The Hacker Crackdown" by Bruce Sterling; "Microserfs" by Douglas Coupland; "Hackers" by Steven Levy; and "The Cathedral and the Bazaar" by Eric S. Raymond. + + If you find any of these hacking manuals in your child's possession, confiscate them immediately. You should also petition local booksellers to remove these titles from their shelves. You may meet with some resistance at first, but even booksellers have to bow to community pressure. + +5. How much time does your child spend using the computer each day? + + If your son spends more than thirty minutes each day on the computer, he may be using it to DOS other peoples sites. DOSing involves gaining access to the "command prompt" on other people's machines, and using it to tie up vital internet services. This can take up to eight hours. If your son is doing this, he is breaking the law, and you should stop him immediately. The safest policy is to limit your children's access to the computer to a maximum of forty-five minutes each day. + +6. Does your son use Quake? + + Quake is an online virtual reality used by hackers. It is a popular meeting place and training ground, where they discuss hacking and train in the use of various firearms. Many hackers develop anti-social tendencies due to the use of this virtual world, and it may cause erratic behaviour at home and at school. + + If your son is using Quake, you should make hime understand that this is not acceptable to you. You should ensure all the firearms in your house are carefully locked away, and have trigger locks installed. You should also bring your concerns to the attention of his school. + +7. Is your son becoming argumentative and surly in his social behaviour? + + As a child enters the electronic world of hacking, he may become disaffected with the real world. He may lose the ability to control his actions, or judge the rightness or wrongness of a course of behaviour. This will manifest itself soonest in the way he treats others. Those whom he disagrees with will be met with scorn, bitterness, and even foul language. He may utter threats of violence of a real or electronic nature. + + Even when confronted, your son will probably find it difficult to talk about this problem to you. He will probably claim that there is no problem, and that you are imagining things. He may tell you that it is you who has the problem, and you should "back off" and "stop smothering him." Do not allow yourself to be deceived. You are the only chance your son has, even if he doesn't understand the situation he is in. Keep trying to get through to him, no matter how much he retreats into himself. + +8. Is your son obsessed with "Lunix"? + + BSD, Lunix, Debian and Mandrake are all versions of an illegal hacker operation system, invented by a Soviet computer hacker named Linyos Torovoltos, before the Russians lost the Cold War. It is based on a program called "xenix", which was written by Microsoft for the US government. These programs are used by hackers to break into other people's computer systems to steal credit card numbers. They may also be used to break into people's stereos to steal their music, using the "mp3" program. Torovoltos is a notorious hacker, responsible for writing many hacker programs, such as "telnet", which is used by hackers to connect to machines on the internet without using a telephone. + + Your son may try to install "lunix" on your hard drive. If he is careful, you may not notice its presence, however, lunix is a capricious beast, and if handled incorrectly, your son may damage your computer, and even break it completely by deleting Windows, at which point you will have to have your computer repaired by a professional. + + If you see the word "LILO" during your windows startup (just after you turn the machine on), your son has installed lunix. In order to get rid of it, you will have to send your computer back to the manufacturer, and have them fit a new hard drive. Lunix is extremely dangerous software, and cannot be removed without destroying part of your hard disk surface. + +9. Has your son radically changed his appearance? + + If your son has undergone a sudden change in his style of dress, you may have a hacker on your hands. Hackers tend to dress in bright, day-glo colors. They may wear baggy pants, bright colored shirts and spiky hair dyed in bright colors to match their clothes. They may take to carrying "glow-sticks" and some wear pacifiers around their necks. (I have no idea why they do this) There are many such hackers in schools today, and your son may have started to associate with them. If you notice that your son's group of friends includes people dressed like this, it is time to think about a severe curfew, to protect him from dangerous influences. + +10. Is your son struggling academically? + + If your son is failing courses in school, or performing poorly on sports teams, he may be involved in a hacking group, such as the infamous "Otaku" hacker association. Excessive time spent on the computer, communicating with his fellow hackers may cause temporary damage to the eyes and brain, from the electromagnetic radiation. This will cause his marks to slip dramatically, particularly in difficult subjects such as Math, and Chemistry. In extreme cases, over-exposure to computer radiation can cause schizophrenia, meningitis and other psychological diseases. Also, the reduction in exercise may cause him to lose muscle mass, and even to start gaining weight. For the sake of your child's mental and physical health, you must put a stop to his hacking, and limit his computer time drastically. + + +I encourage all parents to read through this guide carefully. Your child's future may depend upon it. Hacking is an illegal and dangerous activity, that may land your child in prison, and tear your family apart. It cannot be taken too seriously. diff --git a/teawie_bot/copypastas/navyseal.txt b/teawie_bot/copypastas/navyseal.txt new file mode 100644 index 0000000..cb8eb67 --- /dev/null +++ b/teawie_bot/copypastas/navyseal.txt @@ -0,0 +1 @@ +What the fuck did you just fucking say about me, you little bitch? Iโ€™ll have you know I graduated top of my class in the Navy Seals, and Iโ€™ve been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. I am trained in gorilla warfare and Iโ€™m the top sniper in the entire US armed forces. You are nothing to me but just another target. I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. You think you can get away with saying that shit to me over the Internet? Think again, fucker. As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. The storm that wipes out the pathetic little thing you call your life. Youโ€™re fucking dead, kid. I can be anywhere, anytime, and I can kill you in over seven hundred ways, and thatโ€™s just with my bare hands. Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. If only you could have known what unholy retribution your little โ€œcleverโ€ comment was about to bring down upon you, maybe you would have held your fucking tongue. But you couldnโ€™t, you didnโ€™t, and now youโ€™re paying the price, you goddamn idiot. I will shit fury all over you and you will drown in it. Youโ€™re fucking dead, kiddo. \ No newline at end of file diff --git a/teawie_bot/copypastas/sus.txt b/teawie_bot/copypastas/sus.txt new file mode 100644 index 0000000..a381e3e --- /dev/null +++ b/teawie_bot/copypastas/sus.txt @@ -0,0 +1 @@ +HOLY SHIT DID YOU JUST SAY THE WORD SUS???๐Ÿ˜ณ1?/1๐Ÿ˜ฑ//1๐Ÿ˜ณ/1111!!!! Wait, you don't know what it is from?๐Ÿ˜ณ๐Ÿ˜ณ๐Ÿ˜ณLet ๐Ÿ‘†give you a brief r/history. ๐Ÿ“š๐Ÿ“š๐Ÿ“š๐Ÿ‘จโ€๐Ÿš€If you didn't r/knowyourshit, the r/term sus(suspicious) is a saying from the r/popular r/game r/AmongUs. Among us is so fun๐Ÿ˜” ๐Ÿ‘‰๐Ÿ‘ˆ, don't insult it, every youtuber and streamer says so!!!!!!!11 Corpses voice is so deep am i right or am i right๐Ÿ˜ณ๐Ÿ˜ณ????? I mean Mr beast and Dream play and pull big ๐Ÿง  1000000000000 iq moves in their videos..... YOU WERE THE IMPOSTER.... เถž เถž เถž Get it because you don't know what sus means? r/stupidquestions r/youranidot r/stupidcuck. I CAnT BELEeVE YOUU dont KNoW WHT SUS MeaNS?/??!??!?!!๐Ÿ–•๐Ÿ–•๐Ÿ–•๐Ÿ–•๐Ÿ–• Man why do i have to r/explain this to a r/idiot๐Ÿคช๐Ÿคช๐Ÿคช๐Ÿ“š๐Ÿ“š๐Ÿ“š... Sus is a GREAT WORD from a GREAT VIDEO GAME. in class, YOU CAN PLAY IT ON YOUR PHONE๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ??!?!? such a masterpiece... FOR THE GREAT PRICE OF FREE!!!11!๐Ÿ’ฐ๐Ÿ’ฐ๐Ÿค‘๐Ÿค‘๐Ÿค‘๐Ÿค‘๐Ÿ˜œ๐Ÿ˜œ๐Ÿ˜œ๐Ÿ’ฐ๐Ÿ’ฐ It can also mean gay ๐Ÿ˜ณ๐Ÿ˜ณ๐Ÿ˜ณ๐Ÿ˜ณ \ No newline at end of file diff --git a/teawie_bot/copypastas/ticktock.txt b/teawie_bot/copypastas/ticktock.txt new file mode 100644 index 0000000..22beb4a --- /dev/null +++ b/teawie_bot/copypastas/ticktock.txt @@ -0,0 +1,8 @@ +Tick-tock +Heavy like a Brinks truck +Looking like I'm tip-top +Shining like a wristwatch +Time will grab your wrist +Lock it down 'til the thing pop +Can you stick around for a minute 'til the ring stop? +Please, God \ No newline at end of file diff --git a/teawie_bot/utils.py b/teawie_bot/utils.py new file mode 100644 index 0000000..c75135b --- /dev/null +++ b/teawie_bot/utils.py @@ -0,0 +1,70 @@ +import importlib.resources +import random +from math import ceil + +import discord +from discord.ext import commands + +from teawie_bot import copypastas + +CHAR_LIMIT: int = 2000 + + +# pylint: disable-next=too-few-public-methods +class Teawies: + """ + wrapper class around list[discord.Emoji] + """ + + def __init__(self, bot: commands.Bot): + names = [ + "teawiecry", "teawiederp", "teawiedizzy", + "teawienerdcroppedanddownsized", "teawieneutral", "teawiepet", + "teawiepetfast", "teawiepop", "teawiesmile", "teawiesmug", + "teawiestarstruck", "tei", "wavy", "wie", "manythoughtsheadfull" + ] + + self.emojis: list[str] = [ + str(discord.utils.get(bot.emojis, name=name)) for name in names + ] + + def random(self) -> str: + return random.choice(self.emojis) + + +def get_random_response(bot: commands.Bot) -> str: + responses = [ + "soon", + "maybe", + "perhaps", + "elaborate", + str(discord.utils.get(bot.emojis, name="moyai")), + ] + responses = responses + bot.teawies.emojis + return random.choice(responses) + + +def split_msg(msg: str) -> list[str]: + """ + splits a message into multiple parts so that it + can fit into the discord character limit + """ + split = ceil(len(msg) / ceil(len(msg) / CHAR_LIMIT)) + return [msg[i:i + split] for i in range(0, len(msg), split)] + + +def get_copypasta(name: str) -> list[str]: + try: + res = importlib.resources.read_text(copypastas, name + ".txt") + except OSError: + return ["something went wrong :("] + + if res == "": + return [f"couldn't send copypasta: {name} :("] + + if len(res) >= CHAR_LIMIT: + res = split_msg(res) + else: + res = [res] + + return res -- cgit v1.2.3