-
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.
Merge pull request #15 from Appelsiini1/dev
V1.10.0
- Loading branch information
Showing
15 changed files
with
1,261 additions
and
455 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 |
---|---|---|
|
@@ -123,4 +123,4 @@ modules/test_module.py | |
Coralog.txt | ||
|
||
#Database | ||
databases.db | ||
Databases/ |
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,24 @@ | ||
import os | ||
from logging import exception | ||
from sys import exit | ||
|
||
|
||
def get_tokens(): | ||
"""Gets environment variables. Returns a list.""" | ||
try: | ||
with open(".env", "r") as f: | ||
tokens = f.readlines() | ||
except Exception: | ||
exception("Could not acquire environment variables. Stopping.") | ||
exit(1) | ||
return tokens | ||
|
||
|
||
PREFIX = "!c " | ||
AUTHOR = "This bot is maintained by Appelsiini1" | ||
GIT = "Source code for this bot can be found at https://github.com/Appelsiini1/CoraBot" | ||
DB_F = os.path.dirname(os.path.realpath(__file__)) + "\\Databases\\database.db" | ||
TOKENS = get_tokens() | ||
DISCORD_TOKEN = TOKENS[0].lstrip("TOKEN").strip()[1:] | ||
TWIT_API_KEY = TOKENS[1].lstrip("API_KEY").strip()[1:] | ||
TWIT_API_SECRET = TOKENS[2].lstrip("API_SECRET").strip()[1:] |
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 |
---|---|---|
@@ -1,18 +1,25 @@ | ||
import random | ||
import discord | ||
from modules.common import get_hex_colour #pylint: disable=import-error | ||
from modules.common import get_hex_colour # pylint: disable=import-error | ||
|
||
|
||
async def choose(message): | ||
repl = message.content[9:] | ||
args = repl.strip().split("|") | ||
valid = [x for x in args if x.strip() != ''] | ||
valid = [x for x in args if x.strip() != ""] | ||
|
||
if len(valid) < 2: | ||
msg = "**I need at least 2 options! Syntax: [option1] | [option2] ...**" | ||
else: | ||
random_n = random.randint(0, len(valid)-1) | ||
random_n = random.randint(0, len(valid) - 1) | ||
chosen = valid[random_n] | ||
msg = "**"+ message.author.display_name + ", I choose '" + chosen.strip()+"'!**" | ||
|
||
msg = ( | ||
"**" | ||
+ message.author.display_name | ||
+ ", I choose '" | ||
+ chosen.strip() | ||
+ "'!**" | ||
) | ||
|
||
emb = discord.Embed(title=msg, color=get_hex_colour(cora_eye=True)) | ||
await message.channel.send(embed=emb) |
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
Oops, something went wrong.