-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
91 lines (64 loc) · 2.3 KB
/
main.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
import os
import discord
from dotenv import load_dotenv
from discord.ext import commands
from module import embedAdd
from databasemodule import adddiscordid, removediscordid
from config import help_hint as hint
from notyficationmodule import mainNotiSend
load_dotenv()
KEY_API = os.getenv('DISCORD_TOKEN')
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print('E-Xchange Working!')
@bot.event
async def on_member_join(member):
await member.create_dm()
await member.dm_channel.send(
f'Hello {member.name}, now I will keep you informed about news from the financial world. Good luck'
)
bot.remove_command("help")
mainNotiSend(bot)
@bot.command(name="help")
async def helpComand(ctx):
embed = discord.Embed(
title="Helper", description=f"!price - {hint.price_comand_help}", color=0x3bbdba)
embed.set_footer(text="E-Xchange")
await ctx.author.create_dm()
await ctx.author.dm_channel.send(embed=embed)
@bot.command(name="price", help=hint.price_comand_help)
async def price(ctx):
await ctx.author.create_dm()
await ctx.author.dm_channel.send(hint.price_info)
@bot.command(name="alertON")
async def notyficationON(ctx):
cl_discord_id = ctx.author.id
adddiscordid(cl_discord_id)
await ctx.author.create_dm()
await ctx.author.dm_channel.send(hint.notification_alert_on)
@bot.command(name="alertOFF")
async def notyficationOFF(ctx):
cl_discord_id = ctx.author.id # TODO: remove variable
print(cl_discord_id)
removediscordid(cl_discord_id)
await ctx.author.create_dm()
await ctx.author.dm_channel.send(hint.notification_alert_off)
@bot.command(name="currency")
async def currencyPrice(ctx):
embed = embedAdd('Currency Price', 0x008000, "currency")
await ctx.author.create_dm()
await ctx.author.dm_channel.send(embed=embed)
@bot.command(name="crypto")
async def cryptoPrice(ctx):
embed = embedAdd('Crypto Price', 0x008ec2, "crypto")
await ctx.author.create_dm()
await ctx.author.dm_channel.send(embed=embed)
@bot.command(name="metals")
async def cmetalsPrice(ctx):
embed = embedAdd('Metals Price', 0x797e80, "metals")
await ctx.author.create_dm()
await ctx.author.dm_channel.send(embed=embed)
bot.run(KEY_API)