for ch in range(i):
with open(f'chunk_{ch}', 'rb') as chunk_file:
recordingFile.write(chunk_file.read())
{
"cmd": ["python", "$file"],
"file_patterns": ["*.py"],
"env": {
"PYTHONUNBUFFERED": "1"
},
"cancel": {
"kill": true
},
"encoding": "utf-8"
}
msg = await bot.wait_for('message', timeout=60, check=lambda m: m.channel == message.channel and m.author == message.author)
for attach in msg.attachments:
await attach.save(f"./{message.author.id}.png")
@bot.command()
async def test(ctx):
await ctx.send(
embed=discord.Embed(title="тебе нравится наш сервер?"),
components=[
Button(style=ButtonStyle.red, label="ДА!", custom_id="yes"),
Button(style=ButtonStyle.green, label="ну такое..", custom_id="no"),
]
)
response = await bot.wait_for("button_click")
if response.channel == ctx.channel:
if response.custom_id == "yes":
await response.respond(content="рады стараться!")
else:
await response.respond(content="в чем проблема?")
def response_check(inter):
return inter.channel == ctx.channel
response = await bot.wait_for("button_click", check=response_check)
response = await bot.wait_for("button_click", check=lambda inter: inter.channel == ctx.channel)
@bot.command()
async def test(ctx):
await ctx.send(
embed=discord.Embed(title="тебе нравится наш сервер?"),
components=[
Button(style=ButtonStyle.red, label="ДА!", custom_id="yes"),
Button(style=ButtonStyle.green, label="ну такое..", custom_id="no"),
]
)
response = await bot.wait_for("button_click", check=lambda inter: inter.channel == ctx.channel)
if response.custom_id == "yes":
await response.respond(content="рады стараться!")
else:
await response.respond(content="в чем проблема?")
app = Flask(__name__, static_url_path='/js_and_css')
from flask import send_from_directory
@app.route('/css/<filename>')
def css_folder(filename):
return send_from_directory('css', filename)
@app.route('/js/<filename>')
def js_folder(filename):
return send_from_directory('js', filename)
@client.command()
async def news(ctx):
guild = ctx.guild
async for member in guild.fetch_members(limit=None):
if member != client.user:
await member.send("Приветики!")
print("Отправил", member)
@client.command()
async def news(ctx):
guild = ctx.guild
async for member in guild.fetch_members(limit=None):
if not member.bot:
await member.send("Приветики!")
print("Отправил", member)
if message.attachments:
files = []
for attachment in message.attachments:
files.append(await attachment.to_file())
if files:
user = await bot.fetch_user(user_id) # получение пользователя
dm = await user.create_dm() # получение лс
await dm.send(files=files)
if message.attachments:
files = []
for attachment in message.attachments:
try:
if attachment.content_type.startswith("image/"):
files.append(await attachment.to_file())
except:
continue
if files:
user = await bot.fetch_user(user_id) # получение пользователя
dm = await user.create_dm() # получение лс
await dm.send(files=files)