1
0
mirror of https://gitlab.com/simple-stock-bots/simple-discord-stock-bot.git synced 2025-08-02 03:21:31 +00:00

update package naming

This commit is contained in:
2023-04-16 15:54:20 -06:00
parent 31f12e0b45
commit 4213a20026

23
bot.py
View File

@@ -3,9 +3,9 @@ import io
import logging import logging
import os import os
import discord
import mplfinance as mpf import mplfinance as mpf
from discord.ext import commands import nextcord
from nextcord.ext import commands
from D_info import D_info from D_info import D_info
from symbol_router import Router from symbol_router import Router
@@ -16,16 +16,17 @@ s = Router()
d = D_info() d = D_info()
client = discord.Client() intents = nextcord.Intents.default()
bot = commands.Bot( client = nextcord.Client(intents=intents)
command_prefix="/", bot = commands.Bot(command_prefix="/", description=d.help_text, intents=intents)
description=d.help_text,
)
logger = logging.getLogger("discord") logger = logging.getLogger("nextcord")
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO) logger.setLevel(logging.INFO)
handler = logging.FileHandler(filename="nextcord.log", encoding="utf-8", mode="w")
handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
logger.addHandler(handler)
@bot.event @bot.event
@@ -112,7 +113,7 @@ async def intra(ctx: commands, sym: str):
# Get price so theres no request lag after the image is sent # Get price so theres no request lag after the image is sent
price_reply = s.price_reply([symbol])[0] price_reply = s.price_reply([symbol])[0]
await ctx.send( await ctx.send(
file=discord.File( file=nextcord.File(
buf, buf,
filename=f"{symbol.name}:intra{datetime.date.today().strftime('%S%M%d%b%Y')}.png", filename=f"{symbol.name}:intra{datetime.date.today().strftime('%S%M%d%b%Y')}.png",
), ),
@@ -153,7 +154,7 @@ async def chart(ctx: commands, sym: str):
# Get price so theres no request lag after the image is sent # Get price so theres no request lag after the image is sent
price_reply = s.price_reply([symbol])[0] price_reply = s.price_reply([symbol])[0]
await ctx.send( await ctx.send(
file=discord.File( file=nextcord.File(
buf, buf,
filename=f"{symbol.name}:1M{datetime.date.today().strftime('%d%b%Y')}.png", filename=f"{symbol.name}:1M{datetime.date.today().strftime('%d%b%Y')}.png",
), ),