-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathglobals.py
109 lines (96 loc) · 3.33 KB
/
globals.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
#####################################
# #
# OMI-Chan ::: Global Variables #
# #
#####################################
# REQUIRED MODULES
import asyncio
import collections
import datetime
import discord
from discord.ext import commands, tasks
import json
import lang.en as LANG
import logging
import os
import random
import redis
import requests
import subprocess
import sys
import time
import traceback
# LOCAL DEBUG SWITCH
####################
LOCAL = True # <-- TRUE = Local Sandbox | FALSE = Live Running Bot
####################
# DEV CONTROLS
CONSOLE = True # Set to True to send output to console
DEBUG = True # Set to True to log output to debug.log
LOG_DIR = "./logs/" if LOCAL else "/var/log/omichan/" # Where to place debug.log
LOG_CHAN = False # Set to False to disable, Set to chan ID to log debug output to that channel
# REDIS CONNECTION
R = redis.Redis(host="127.0.0.1", port=6379, decode_responses=True)
if not R.ping():
print(" >>> ERROR >>> Unable to connect to Redis @ 127.0.0.1:6379")
exit()
RedisServerInfo = R.info()
print(" >>> BOOTUP >>> Connected to Redis Server v{}".format(RedisServerInfo["redis_version"]))
# REDIS KEY MAPPING
RKEY_GUILDS = "OMI::Guilds" # {guild_id:timestamp} <-- Lists all installed guilds and their install timestamp
RKEY_RETIRED = "OMI::Retired" # {guild_id:timestamp} <-- Lists all retired guilds and their uninstall timestamp
RKEY_GUILD = "OMI::Guild::{0}" # {key:value} <-- Per-guild settings
RKEY_USERS = "OMI::Users" # {user_id:timestamp} <-- Lists all registered users and their registration timestamp
RKEY_USER = "OMI::User::{0}" # {key:value} <-- Per-member settings
RKEY_FLAGS = "OMI::Flags" # {user_id:flag,flag,flag} <-- Flags set to handle various function flow
RKEY_ROLES = "OMI::Roles::{0}" # {role_key:role_id} <-- Stores functional bot roles per guild with their unique IDs
RKEY_CHANS = "OMI::Chans::{0}" # {chan_key:chan_id(s)} <-- Stores functional channels per guild with their unique IDs
RKEY_TIMERS = "OMI::Timers" # {message_id:timestamp} <-- Tracks internal messages and when they are to be deleted
# BOT INFORMATION
PREFIX = "?"
UUID = 464983705140854784 if LOCAL else 869826190662311936 # OMI-Chan
DEVS = [
390246955282071564 # Cause
]
INTENTS = discord.Intents.default()
INTENTS.members = True
INTENTS.presences = True
BOT = commands.Bot(command_prefix=PREFIX, description="OMI Discord Bot", case_insensitive=True, intents=INTENTS)
BOT.remove_command("help")
print(" >>> BOOTUP >>> Connected to Discord API")
# DEFINE COMMAND SETS
CMDS = [
"cmds.admin",
"cmds.developer",
"cmds.fun",
"cmds.member",
"cmds.support",
]
# EMBED STRIPE COLORS
COLOR = {
"black" : 0x000000,
"gray" : 0x999999,
"white" : 0xffffff,
"red" : 0xff0000,
"orange" : 0xff9900,
"yellow" : 0xffcc4d,
"green" : 0x00ff00,
"blue" : 0x0099ff,
"purple" : 0x9933ee,
"pink" : 0xff88aa,
}
# DISCORD EMBED FOOTER
FOOTER_TEXT = ""
FOOTER_ICON = ""
# These commands can be given in private messages
DM_SAFE_CMDS = [
"help",
"debug",
"methods",
"poweroff",
"install",
]
ROLENAME_ADMIN = "OMI Bot Admin"
ROLENAME_MEMBER = "OMI Member"
#########################################
######################################EOF