Compare commits
3 Commits
f14948e497
...
f38f52a78d
| Author | SHA1 | Date | |
|---|---|---|---|
| f38f52a78d | |||
| 11a90cbadd | |||
| a63658c13d |
45
[REDACTED].py
Executable file
45
[REDACTED].py
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import discord
|
||||||
|
from discord.ext import commands
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
|
import database
|
||||||
|
|
||||||
|
# Create custom logging handler
|
||||||
|
console_handler = logging.StreamHandler(sys.stdout)
|
||||||
|
console_formatter = logging.Formatter(
|
||||||
|
"[%(asctime)s] [%(levelname)s] [%(name)s] %(message)s")
|
||||||
|
console_handler.setFormatter(console_formatter)
|
||||||
|
|
||||||
|
# Make sure all loggers use this handler
|
||||||
|
root_logger = logging.getLogger()
|
||||||
|
root_logger.setLevel(logging.INFO)
|
||||||
|
root_logger.addHandler(console_handler)
|
||||||
|
|
||||||
|
# Get bot logger
|
||||||
|
logger = logging.getLogger("[REDACTED]-bot")
|
||||||
|
|
||||||
|
# Load credentials
|
||||||
|
load_dotenv()
|
||||||
|
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||||
|
|
||||||
|
# client = discord.Client()
|
||||||
|
client = commands.Bot(
|
||||||
|
command_prefix = '!', intents=discord.Intents.all(), log_hander=False)
|
||||||
|
|
||||||
|
# You need to import os for this method
|
||||||
|
@client.event
|
||||||
|
async def on_ready():
|
||||||
|
logger.info(f'{client.user} is now running')
|
||||||
|
# Load cogs
|
||||||
|
for filename in os.listdir('./cogs'):
|
||||||
|
if filename.endswith('.py'):
|
||||||
|
await client.load_extension(f'cogs.{filename[:-3]}')
|
||||||
|
logger.info(f'Loaded {filename} cog')
|
||||||
|
|
||||||
|
client.run(TOKEN, log_handler=None)
|
||||||
12
__main__.py
12
__main__.py
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
"""
|
"""
|
||||||
BoywifeBot - A Discord bot for the Gayming Group Discord server.
|
[REDACTED] - A Discord bot for the [REDACTED] Discord server.
|
||||||
|
|
||||||
This program provides a bot that plays music in a voice chat and fulfills other
|
This program provides a bot that plays music in a voice chat and fulfills other
|
||||||
commands in text channels.
|
commands in text channels.
|
||||||
@ -12,7 +12,7 @@ Version: 0.1.0
|
|||||||
For detailed documentation, please refer to:
|
For detailed documentation, please refer to:
|
||||||
<url>
|
<url>
|
||||||
Source Code:
|
Source Code:
|
||||||
https://github.com/jtkick/boywife-bot
|
https://github.com/jtkick/[REDACTED]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
PROJECT_VERSION = "0.1.0"
|
PROJECT_VERSION = "0.1.0"
|
||||||
@ -44,19 +44,19 @@ def main():
|
|||||||
root_logger.addHandler(console_handler)
|
root_logger.addHandler(console_handler)
|
||||||
|
|
||||||
# Get bot logger
|
# Get bot logger
|
||||||
logger = logging.getLogger("boywife-bot")
|
logger = logging.getLogger("[REDACTED]-bot")
|
||||||
|
|
||||||
# Load credentials
|
# Load credentials
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
TOKEN = os.getenv('DISCORD_TOKEN')
|
TOKEN = os.getenv('DISCORD_TOKEN')
|
||||||
|
|
||||||
# Create custom bot with database connection
|
# Create custom bot with database connection
|
||||||
class BoywifeBot(commands.Bot):
|
class [REDACTED]Bot(commands.Bot):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.db = database.Database("boywife_bot.db")
|
self.db = database.Database("[REDACTED]_bot.db")
|
||||||
self.ai = OpenAI()
|
self.ai = OpenAI()
|
||||||
client = BoywifeBot(
|
client = [REDACTED]Bot(
|
||||||
command_prefix = '!',
|
command_prefix = '!',
|
||||||
intents=discord.Intents.all(),
|
intents=discord.Intents.all(),
|
||||||
log_hander=False
|
log_hander=False
|
||||||
|
|||||||
BIN
boywife.png
BIN
boywife.png
Binary file not shown.
|
Before Width: | Height: | Size: 101 KiB |
@ -10,11 +10,20 @@ import typing
|
|||||||
class Activities(commands.Cog):
|
class Activities(commands.Cog):
|
||||||
"""A cog to track and gather statistics on user activities."""
|
"""A cog to track and gather statistics on user activities."""
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
|
"""Related commands."""
|
||||||
|
__slots__ = ("nerd", "nerds", [REDACTED], [REDACTED])
|
||||||
|
=======
|
||||||
__slots__ = ("nerd", "nerds", "fword", "fwords")
|
__slots__ = ("nerd", "nerds", "fword", "fwords")
|
||||||
|
>>>>>>> 669339f (Made player controls based on Discord actions.)
|
||||||
|
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.logger = logging.getLogger("activities")
|
self.logger = logging.getLogger("activities")
|
||||||
|
<<<<<<< HEAD
|
||||||
|
self.db = database.Database("[REDACTED]_bot.db")
|
||||||
|
=======
|
||||||
|
>>>>>>> 669339f (Made player controls based on Discord actions.)
|
||||||
|
|
||||||
async def __local_check(self, ctx):
|
async def __local_check(self, ctx):
|
||||||
"""A local check which applies to all commands in this cog."""
|
"""A local check which applies to all commands in this cog."""
|
||||||
|
|||||||
@ -68,7 +68,7 @@ class Chatbot(commands.Cog):
|
|||||||
print(e)
|
print(e)
|
||||||
return '😴'
|
return '😴'
|
||||||
|
|
||||||
@commands.command(name='chat', aliases=['boywife', 'bb', 'bw', 'bot'], description="Command for chatting with chatbot.")
|
@commands.command(name='chat', aliases=[[REDACTED], [REDACTED], [REDACTED], 'bot'], description="Command for chatting with chatbot.")
|
||||||
async def chat_(self, ctx, *text):
|
async def chat_(self, ctx, *text):
|
||||||
await ctx.send(self.prompt(' '.join(text)))
|
await ctx.send(self.prompt(' '.join(text)))
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,9 @@ LASTFM_API_KEY = os.getenv("LASTFM_API_KEY")
|
|||||||
|
|
||||||
# TEMORARY LIST OF SONGS
|
# TEMORARY LIST OF SONGS
|
||||||
songs = [
|
songs = [
|
||||||
|
<<<<<<< HEAD
|
||||||
|
[REDACTED]
|
||||||
|
=======
|
||||||
"I Love It - Icona Pop",
|
"I Love It - Icona Pop",
|
||||||
"Vanished - Crystal Castles",
|
"Vanished - Crystal Castles",
|
||||||
"We Like To Party - Vengaboys",
|
"We Like To Party - Vengaboys",
|
||||||
@ -86,6 +89,7 @@ songs = [
|
|||||||
"Baddy On The Floor - Jamix xx",
|
"Baddy On The Floor - Jamix xx",
|
||||||
"SWEET HONEY BUCKIIN' - Beyonce",
|
"SWEET HONEY BUCKIIN' - Beyonce",
|
||||||
"Boots & Boys - Ke$ha",
|
"Boots & Boys - Ke$ha",
|
||||||
|
>>>>>>> 669339f (Made player controls based on Discord actions.)
|
||||||
]
|
]
|
||||||
|
|
||||||
# Suppress noise about console usage from errors
|
# Suppress noise about console usage from errors
|
||||||
@ -551,6 +555,30 @@ class Music(commands.Cog):
|
|||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
self.players = {}
|
self.players = {}
|
||||||
|
<<<<<<< HEAD
|
||||||
|
self.last_tag_play_time = datetime.datetime.now()
|
||||||
|
|
||||||
|
# Get a reference to the database
|
||||||
|
# TODO: MAKE THIS INJECTED
|
||||||
|
self.db = database.Database("[REDACTED]_bot.db")
|
||||||
|
|
||||||
|
# def update_cache():
|
||||||
|
# with yt_dlp.YoutubeDL({'quiet': True}) as ydl:
|
||||||
|
# self.[REDACTED]_tracks = ydl.extract_info('https://soundcloud.com/[REDACTED]', download=False)['entries']
|
||||||
|
|
||||||
|
# with open('soundcloud-cache', 'w') as f:
|
||||||
|
# f.write(str(self.[REDACTED]_tracks))
|
||||||
|
# # pickle.dump(self.[REDACTED]_tracks, f)
|
||||||
|
|
||||||
|
# if os.path.exists('soundcloud-cache'):
|
||||||
|
# with open('soundcloud-cache', 'r') as f:
|
||||||
|
# exec(f'self.[REDACTED]_tracks = {f.read()}')
|
||||||
|
# # self.[REDACTED]_tracks = pickle.load(f)
|
||||||
|
# threading.Thread(target=update_cache).start()
|
||||||
|
# else:
|
||||||
|
# update_cache()
|
||||||
|
=======
|
||||||
|
>>>>>>> 669339f (Made player controls based on Discord actions.)
|
||||||
|
|
||||||
async def cleanup(self, guild):
|
async def cleanup(self, guild):
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -6,7 +6,11 @@ import typing
|
|||||||
from cogs import music_player
|
from cogs import music_player
|
||||||
|
|
||||||
class Database:
|
class Database:
|
||||||
|
<<<<<<< HEAD
|
||||||
|
def __init__(self, path: str = "[REDACTED]_bot.db"):
|
||||||
|
=======
|
||||||
def __init__(self, path: str):
|
def __init__(self, path: str):
|
||||||
|
>>>>>>> 669339f (Made player controls based on Discord actions.)
|
||||||
self.path = path
|
self.path = path
|
||||||
self._ensure_db()
|
self._ensure_db()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user