Skip to content

Commit

Permalink
Hotfix for v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rarmash committed Jun 15, 2024
1 parent ff74154 commit 6fef65c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions .env_template
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ TOKEN=
APPLICATIONID=
FORTNITEAPI=
XBOXAPI=
FIREBASEURL=
DEBUGMODE=OFF
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# R4Bot ![Version](https://img.shields.io/badge/Latest-1.1.1/master-blue.svg)
# R4Bot ![Version](https://img.shields.io/badge/Latest-1.1.2/master-blue.svg)
Discord-бот, созданный для облегчения модерации серверов, и не только. Используются слэш-команды.

## 🛠️ Установка
Expand Down Expand Up @@ -60,5 +60,6 @@ TOKEN= // Токен бота Discord
APPLICATIONID= // Application ID приложения бота с Discord Developer Portal
FORTNITEAPI= // Ключ API для получения данных с https://fortnite-api.com/
XBOXAPI= // Ключ API для получения данных с https://xbl.io/
FIREBASEURL= // Адрес для подключения к БД Firebase Realtime
DEBUGMODE=OFF // Значение DEBUG-режима
```
8 changes: 5 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import discord

from modules.firebase import create_firebase_app
from options import token, debugmode, version, gearsList
from options import token, debugmode, version, gearsList, firebaseURL

create_firebase_app()
create_firebase_app(firebaseURL)

# Define intents for the bot to receive all available events
intents = discord.Intents.all()
Expand All @@ -14,6 +14,7 @@
# Create the Discord bot instance with specified intents
bot = discord.Bot(case_insensitive=True, intents=intents)


# Gears are always cool

# Event that runs when the bot is ready and connected to Discord
Expand All @@ -27,7 +28,7 @@ async def on_ready():
for guild in bot.guilds:
print(f"Подключились к серверу: {guild}")
print("------")

# Set bot status and activity based on debug mode
if debugmode == "ON":
status = discord.Status.dnd
Expand All @@ -37,6 +38,7 @@ async def on_ready():
activity = discord.Activity(type=discord.ActivityType.listening, name=f"обиды участников (v{version})")
await bot.change_presence(status=status, activity=activity)


for module_name in gearsList:
try:
bot.load_extension(f'gears.{module_name}')
Expand Down
6 changes: 3 additions & 3 deletions modules/firebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from firebase_admin import credentials, initialize_app, db


def create_firebase_app():
cred_obj = credentials.Certificate("firebaseConfig.json", )
def create_firebase_app(databaseURL: str):
cred_obj = credentials.Certificate("firebaseConfig.json")
firebase = initialize_app(cred_obj,
{"databaseURL": "https://r4bot-50baf-default-rtdb.firebaseio.com/"})
{"databaseURL": databaseURL})
return firebase


Expand Down
3 changes: 2 additions & 1 deletion options.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@
# Load environment variables from .env file
load_dotenv()

version = "1.1.1"
version = "1.1.2"

# Get environment variables
token = environ.get('TOKEN')
applicationID = environ.get('APPLICATIONID')
fortniteapi = environ.get('FORTNITEAPI')
xboxapi = environ.get('XBOXAPI')
firebaseURL = environ.get('FIREBASEURL')
debugmode = environ.get('DEBUGMODE')

try:
Expand Down

0 comments on commit 6fef65c

Please sign in to comment.