Professional Documents
Culture Documents
Новый текстовый документ
Новый текстовый документ
import json
import random as rand
import requests
import asyncio
from discord.ext import commands
import os
@bot.event
async def on_ready():
print("запустился!")
@bot.command(aliases = ['пена'])
async def ping(ctx):
await ctx.send("ненада")
@bot.event
async def on_message_edit(before, after):
if before.content == after.content:
return
await before.channel.send(f"Сообщение было изменено!\n{before.content} ->
{after.content}")
@bot.command()
async def мем(ctx):
response = requests.get('https://some-random-api.ml/meme')
json_data = json.loads(response.text)
embed = discord.Embed(color = 0x006400, title = '🤣')
embed.set_image(url = json_data ['image'])
await ctx.send(embed = embed)
@bot.command()
async def собака(ctx):
response = requests.get('https://some-random-api.ml/img/dog')
json_data = json.loads(response.text)
embed = discord.Embed(color = 0x8B4513, title = '❤')
embed.set_image(url = json_data ['link'])
await ctx.send(embed = embed)
@bot.command()
async def кот(ctx):
response = requests.get('https://some-random-api.ml/img/cat')
json_data = response.json()
embed = discord.Embed(color = 0xF0E68C, title = '❤')
embed.set_image(url = json_data ['link'])
await ctx.send(embed = embed)
@bot.command()
async def рандом(ctx, num1 = None, num2 = None):
author= ctx.message.author
avatar = author.avatar_url
if num1 != None:
if num2 != None:
x = int(num1)
y = int(num2)
if x < y:
value = rand.randint(x,y)
embed=discord.Embed(title='Случайное число',
description=f'{author.mention}, вот ваше число: \n**{value}**')
embed.set_author(name=f"{author}", icon_url=f"{avatar}")
await ctx.send(embed=embed)
else:
await ctx.send("Первое число больше второго")
else:
await ctx.send('Вы не ввели наибольшее число!')
else:
await ctx.send('Вы не ввели наименьшее число')
@bot.command()
async def инфо(ctx):
embed = discord.Embed(title="Grapper", description="БОТЯРА для сервера.",
color=0xeee657)
embed.add_field(name="Автор", value="<Zernovoy#0004>")
embed.add_field(name="Сервера", value=f"{len(bot.guilds)}")
embed.add_field(name="Приглашение:",
value="[приглашение](<https://discord.gg/ac9cfyTfM2>)")
await ctx.send(embed=embed)
@bot.command()
async def баланс(self,ctx):
await self.open_account(ctx_author)
user = ctx.author
users = await get_bank_data()
wallet_amt = users[str(user.id)]["wallet"]
bank_amt = users[str(user.id)]["bank"]
@bot.command()
async def beg(self,ctx):
await self.open_account(ctx.author)
user = ctx.author
earnings = random.randrange(101)
with open("mainbank.json","w") as f:
json.dump(users,f)
if str(user.id) in users:
return False
else:
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
with open("mainbank.json","w") as f:
json.dump(users,f)
return True
bot.run("ODYzMTcwOTk1MDg3MDgxNDcz.YOjAog.8QnHz5QTPmAKmpBlsZxe8zn3uu4")