import random
import time
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
bot.remove_command('help')
@bot.event
async def on_ready():
print("Bot")
await bot.change_presence(status=discord.Status.idle, activity=discord.Game(f'Играет в !help (:'))
@bot.event
async def on_command_error(ctx, error):
pass
@bot.event
async def on_member_join(member):
channel = bot.get_channel(1047781357851525140)
emb = discord.Embed(title=f"⭐ Звезда ``{member.name}`` присоеденился к нам!", color=1 * 1 * 255)
emb.set_image(
url='https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQkFUKue6dR2em-45t8m3ME2LX-FO11EtOMwg&usqp=CAU')
emb.add_field(name="``▪``", value="+ Прочитайте правила, незнания правил не освобождает от ответсвенности!")
emb.add_field(name="``▪``", value="+ Спасибо за то что Присоеденились к нам!")
emb_m = discord.Embed(
title = f"Звезда ``{member.name}`` Добро пожаловать на сервер Astral Hangout""", color= 1 * 1 *255)
await channel.send(embed=emb)
await member.send(embed=emb_m)
@bot.command(name="cmds", description="Данные о командах")
async def cmds(ctx, command=None):
emb = discord.Embed(title="``Помощь``", color=1 * 1 * 255)
for command in bot.commands:
descr = command.description
emb.add_field(name=f"> ``{comfig.prefix}{command}``", value=f"{descr}")
emb_a = discord.Embed(title="``Помощь``", color=1 * 1 * 255)
for command in bot.commands:
descr = command.description
emb_a.add_field(name=f"> ``{comfig.prefix}{command}``", value=f"{descr}")
await ctx.author.send(embed=emb_a)
await ctx.send(embed=emb)
@bot.command(name="members", description="Скажет сколько участников сейчас на сервере")
async def members(ctx):
guild = ctx.guild
emb = discord.Embed(color=ctx.message.author.color, title=f"На сервере {guild.member_count} участников ")
await ctx.send(embed=emb)
@bot.command(name="dice", description="Подкиньте Кубик!")
async def dice(ctx):
await ctx.send("Подкидываем...")
time.sleep(2)
await ctx.channel.purge(limit=1)
await ctx.send(file=discord.File(random.choice(['dice-01.png', 'dice-02.png', 'dice-03.png', 'dice-04.png', 'dice-05.png', 'dice-0.png'])))
@bot.command(name="Скажи слова за бота!", description="Пишит от имени бота(не абьюзить)")
async def say(ctx, *, text):
emb = discord.Embed(title=text, colour=discord.Color.red())
emb.add_field(name='Захотел', value=f"@{ctx.message.author.display_name}")
await ctx.message.delete()
await ctx.send(embed=emb)
@bot.command(name="giveid", description="Выдает id канала")
@commands.has_permissions()
async def giveid(ctx):
await ctx.send(ctx.channel.id)
@bot.command(name="bot", description="О боте")
async def botinfo(ctx):
emb = discord.Embed(color = 0x0000ff , title=""""Информация
\n| Скриптер & Разработчик - @astrxl#0001
\n| Версия Бота - 0.1alpha""")
await ctx.send(embed=emb)
@bot.command(name="50/50 game", description="Рандомайзер на 50/50!")
async def game(ctx, *, text):
num_sp = ["Поздравляем вы выйграли! ✔ ", "Упс! Сегодня не ваш счастливый день!❌ "]
magic_ball = random.choice(num_sp)
emb = discord.Embed(title=f"Результат - {text}", color=ctx.message.author.color)
emb.add_field(name="``Итог:``", value=f'{magic_ball}')
emb.add_field(name="``Участник``", value=f"{ctx.message.author.display_name}")
await ctx.send(embed=emb)
@bot.command(name="jinfo", description="Узнайте когда человек зарегестрировался!")
async def jinfo(ctx, member: discord.Member):
joined_at = member.joined_at.strftime("%b %d, %Y, %T")
await ctx.send(f" {member.mention} Joined at {joined_at}")
@bot.command(name="clear", description="очистка чата")
@commands.has_permissions(administrator=True)
async def clear(ctx, amount: int):
if amount >= 200:
await ctx.channel.purge(limit=1)
emb = discord.Embed(title="Нельзя удалить больше 200 сообщений!", color=ctx.message.author.color)
emb.add_field(name='Удалил', value=f"<@{ctx.message.author.display_name}")
else:
await ctx.channel.purge(limit=amount)
emb = discord.Embed(title=f"> ✅ Успешно ", color=ctx.message.author.color)
emb.add_field(name="> ️ Удалено", value=f"{amount} - сообщений")
emb.add_field(name="> Администратор", value=f"<@{ctx.message.author.display_name}")
await ctx.send(embed=emb)
@clear.error
async def clear_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send("> ❌ Укажите количество удаляемых сообщений")
@game.error
async def game_error(ctx, error):
if isinstance(error, commands.MissingRequiredArgument):
await ctx.send("> ❌ Скажите что нибудь")
# @bot.command() # / @commands.command()
# async def role(ctx, member: discord.Member, *, role: discord.Role):
# Gives specified role to specified member
# await member.add_roles(role)
# await ctx.message.delete()
_log.info('logging in using static token')
_log.info('Shard ID %s has connected to Gateway (Session ID: %s).', self.shard_id, self.session_id)
bot.run("token")