-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
2022 11 16 - Merge with Old MiBot Folder
- Loading branch information
Showing
892 changed files
with
43,802 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# The command that runs the program. | ||
run = ["python3", "main.py"] | ||
# The primary language of the repl. There can be others, though! | ||
language = "python3" | ||
# The main file, which will be shown by default in the editor. | ||
entrypoint = "main.py" | ||
# A list of globs that specify which files and directories should | ||
# be hidden in the workspace. | ||
hidden = ["venv", ".config", "**/__pycache__", "**/.mypy_cache", "**/*.pyc"] | ||
|
||
# Specifies which nix channel to use when building the environment. | ||
[nix] | ||
channel = "stable-21_11" | ||
|
||
# Per-language configuration: python3 | ||
[languages.python3] | ||
# Treats all files that end with `.py` as Python. | ||
pattern = "**/*.py" | ||
# Tells the workspace editor to syntax-highlight these files as | ||
# Python. | ||
syntax = "python" | ||
|
||
# The command needed to start the Language Server Protocol. For | ||
# linting and formatting. | ||
[languages.python3.languageServer] | ||
start = ["pyls"] | ||
|
||
# The command to start the interpreter. | ||
[interpreter] | ||
[interpreter.command] | ||
args = [ | ||
"stderred", | ||
"--", | ||
"prybar-python3", | ||
"-q", | ||
"--ps1", | ||
"\u0001\u001b[33m\u0002\u0001\u001b[00m\u0002 ", | ||
"-i", | ||
] | ||
|
||
# The environment variables needed to correctly start Python and use the | ||
# package proxy. | ||
[env] | ||
VIRTUAL_ENV = "/home/runner/${REPL_SLUG}/venv" | ||
PATH = "${VIRTUAL_ENV}/bin" | ||
PYTHONPATH="${VIRTUAL_ENV}/lib/python3.8/site-packages" | ||
REPLIT_POETRY_PYPI_REPOSITORY="https://package-proxy.replit.com/pypi/" | ||
MPLBACKEND="TkAgg" | ||
|
||
# Enable unit tests. This is only supported for a few languages. | ||
[unitTest] | ||
language = "python3" | ||
|
||
# Add a debugger! | ||
[debugger] | ||
support = true | ||
|
||
# How to start the debugger. | ||
[debugger.interactive] | ||
transport = "localhost:0" | ||
startCommand = ["dap-python", "main.py"] | ||
|
||
# How to communicate with the debugger. | ||
[debugger.interactive.integratedAdapter] | ||
dapTcpAddress = "localhost:0" | ||
|
||
# How to tell the debugger to start a debugging session. | ||
[debugger.interactive.initializeMessage] | ||
command = "initialize" | ||
type = "request" | ||
|
||
[debugger.interactive.initializeMessage.arguments] | ||
adapterID = "debugpy" | ||
clientID = "replit" | ||
clientName = "replit.com" | ||
columnsStartAt1 = true | ||
linesStartAt1 = true | ||
locale = "en-us" | ||
pathFormat = "path" | ||
supportsInvalidatedEvent = true | ||
supportsProgressReporting = true | ||
supportsRunInTerminalRequest = true | ||
supportsVariablePaging = true | ||
supportsVariableType = true | ||
|
||
# How to tell the debugger to start the debuggee application. | ||
[debugger.interactive.launchMessage] | ||
command = "attach" | ||
type = "request" | ||
|
||
[debugger.interactive.launchMessage.arguments] | ||
logging = {} | ||
|
||
# Configures the packager. | ||
[packager] | ||
# Search packages in PyPI. | ||
language = "python3" | ||
# Never attempt to install `unit_tests`. If there are packages that are being | ||
# guessed wrongly, add them here. | ||
ignoredPackages = ["unit_tests"] | ||
|
||
[packager.features] | ||
enabledForHosting = false | ||
# Enable searching packages from the sidebar. | ||
packageSearch = true | ||
# Enable guessing what packages are needed from the code. | ||
guessImports = true |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from flask import Flask | ||
from threading import Thread | ||
import webbrowser | ||
|
||
app = Flask('') | ||
|
||
@app.route('/') | ||
def home(): | ||
return "Hello, It Works!" | ||
|
||
def run(): | ||
app.run(host='0.0.0.0',port=8080) | ||
|
||
def keep_alive(): | ||
t = Thread(target=run) | ||
t.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import os | ||
import discord | ||
import requests | ||
import json | ||
import random | ||
from replit import db | ||
from keep_alive import keep_alive | ||
|
||
my_secret = os.getenv('TOKEN') | ||
|
||
client = discord.Client() | ||
|
||
sad_words = ["sad", "depressed", "unhappy", "angry", "miserable"] | ||
|
||
starter_encouragements = [ | ||
"Cheer up!", "Hang in there.", "You are a great person / bot!" | ||
] | ||
|
||
cool_words = ["happy", "kind", "cheer", "great", "beautiful"] | ||
|
||
if "responding" not in db.keys(): | ||
db["responding"] = True | ||
|
||
|
||
def get_quote(): | ||
response = requests.get("https://zenquotes.io/api/random") | ||
json_data = json.loads(response.text) | ||
quote = json_data[0]["q"] + " -" + json_data[0]["a"] | ||
return (quote) | ||
|
||
|
||
def update_encouragements(encouraging_message): | ||
if "encouragements" in db.keys(): | ||
encouragements = db["encouragements"] | ||
encouragements.append(encouraging_message) | ||
db["encouragements"] = encouragements | ||
else: | ||
db["encouragements"] = [encouraging_message] | ||
|
||
|
||
def delete_encouragment(index): | ||
encouragements = db["encouragements"] | ||
if len(encouragements) > index: | ||
del encouragements[index] | ||
db["encouragements"] = encouragements | ||
|
||
|
||
@client.event | ||
async def on_ready(): | ||
print("We have logged in as {0.user}".format(client)) | ||
|
||
|
||
@client.event | ||
async def on_message(message): | ||
if message.author == client.user: | ||
return | ||
|
||
msg = message.content | ||
|
||
if msg.startswith("$inspire"): | ||
quote = get_quote() | ||
await message.channel.send(quote) | ||
|
||
if db["responding"]: | ||
options = starter_encouragements | ||
if "encouragements" in db.keys(): | ||
options = options + db["encouragements"] | ||
|
||
if any(word in msg for word in sad_words): | ||
await message.channel.send(random.choice(options)) | ||
if any(word in msg for word in cool_words): | ||
await message.channel.send(random.choice(options)) | ||
|
||
if msg.startswith("$new"): | ||
encouraging_message = msg.split("$new ", 1)[1] | ||
update_encouragements(encouraging_message) | ||
await message.channel.send("New encouraging message added.") | ||
|
||
if msg.startswith("$del"): | ||
encouragements = [] | ||
if "encouragements" in db.keys(): | ||
index = int(msg.split("$del", 1)[1]) | ||
delete_encouragment(index) | ||
encouragements = db["encouragements"] | ||
await message.channel.send(encouragements) | ||
|
||
if msg.startswith("$list"): | ||
encouragements = [] | ||
if "encouragements" in db.keys(): | ||
encouragements = db["encouragements"] | ||
await message.channel.send(encouragements) | ||
|
||
if msg.startswith("$responding"): | ||
value = msg.split("$responding ", 1)[1] | ||
|
||
if value.lower() == "true": | ||
db["responding"] = True | ||
await message.channel.send("Responding is on.") | ||
else: | ||
db["responding"] = False | ||
await message.channel.send("Responding is off.") | ||
|
||
|
||
keep_alive() | ||
client.run(my_secret) |
Oops, something went wrong.