Beeleon Developers
Giriş yap

discord.js uyumluluk katmanı

beeleon-discord.mjs, discord.js'in sık kullanılan sınıflarını Beeleon API'sine çeviren tek dosyalık bir katmandır. Çoğu bot için tek satır değişir:

js
// önce
import { Client, GatewayIntentBits, Events, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js';
// sonra
import { Client, GatewayIntentBits, Events, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } from './beeleon-discord.mjs';

beeleon-discord.mjs ve beeleon.mjs dosyalarını botunun yanına koy (ikisi de Developer Portal › Bot şablonları sekmesinden ya da /dev/sdk/ adresinden indirilir). Node.js 22+ gerekir. Token olarak Beeleon bot tokenını ver: client.login('UYGULAMA_ID.GIZLI').

Örnek#

js
import { Client, GatewayIntentBits, Events, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, SlashCommandBuilder, Colors } from './beeleon-discord.mjs';

const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages] });

client.once(Events.ClientReady, async c => {
  await c.application.commands.set([new SlashCommandBuilder().setName('bilgi').setDescription('Bilgi kartı')]);
  console.log('Hazır:', c.user.tag);
});

client.on(Events.InteractionCreate, async i => {
  if (i.isChatInputCommand() && i.commandName === 'bilgi') {
    const e = new EmbedBuilder().setTitle('Beeleon').setDescription('discord.js katmanıyla çalışıyor').setColor(Colors.Blurple).addFields({ name: 'Sen', value: `${i.user}` });
    const row = new ActionRowBuilder().addComponents(new ButtonBuilder().setCustomId('tamam').setLabel('Tamam').setStyle(ButtonStyle.Success));
    await i.reply({ embeds: [e], components: [row] });
  }
  if (i.isButton() && i.customId === 'tamam') await i.update({ content: '✅', embeds: [], components: [] });
});

client.login(process.env.TOKEN);

Desteklenenler#

discord.jsBeeleon karşılığı
Client, login, on/once, user, guilds.cache, application.commands.setGateway + komut kaydı
Events.ClientReady, InteractionCreate, MessageCreate, MessageUpdate, MessageDelete, GuildCreate, GuildMemberAdd, GuildMemberRemoveAynı olaylar
isChatInputCommand, isButton, isStringSelectMenu, isUserSelectMenu, isRoleSelectMenu, isChannelSelectMenu, isModalSubmit, isAutocompleteEtkileşim türleri
reply, update, deferReply + editReply, followUp, showModal, respondEtkileşim yanıtları (ephemeral ya da flags: MessageFlags.Ephemeral)
options.getString/Integer/Number/Boolean/User/Member/Channel/Role/Subcommand/SubcommandGroup/FocusedSeçenekler
EmbedBuilderContainer: başlık → title, açıklama → text, alanlar → fields, görsel → banner, küçük resim → section, alt bilgi → footer, renk → accent. Birden çok embed tek container'da ayraçla birleşir
ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, UserSelectMenuBuilder, RoleSelectMenuBuilder, ChannelSelectMenuBuilderDüğme ve menü satırları
ModalBuilder, TextInputBuilder, TextInputStyleFormlar
SlashCommandBuilder (alt komut ve grup dahil), ContextMenuCommandBuilderKomut tanımları
message.reply, message.channel.send, message.react, message.edit, message.deleteMesaj işlemleri
client.user.setActivity, setStatusDurum

Bilinen farklar#

  • Embed görselleri (setImage, setThumbnail, yazar/alt bilgi simgesi) Beeleon'a yüklenmiş /cdn/... dosyası olmalıdır; dış adresler gösterilmez. Dosyayı client.rest.upload(blob, ad) ile yükleyip dönen url'yi kullan.
  • Ses (voice) bağlantıları, sticker gönderme ve thread yönetimi bu katmanda yoktur; gerekirse client._bl.api(yöntem, yol, gövde) ile REST API'yi doğrudan çağır.
  • deferReply sonrası editReply gerçek yanıtı gönderir (Beeleon'da her etkileşime 15 dakika içinde bir kez yanıt verilir).
  • İzin bitleri (PermissionFlagsBits) Discord'unkiyle aynı değildir; bkz. İzinler.

Son güncelleme: · Markdown olarak görüntüle