@dawalters1/wolf.js v0.20.0-beta.43
0.20.0 - ⚠️ CONTAINS BREAKING CHANGES ⚠️
❗❗ Breaking Changes ❗❗
- Events are now handled with manual eventStrings
api.on.eventName((... args)=>{}) -> api.on('eventName', (... args)=>{})
Deprecations (OLD -> NEW)
api.tip() -> api.tipping()
api.deleteCharms() -> api.charm().remove()
api.setSelectedCharms() -> api.charm().set()
api.getCrediteBalance() -> api.store().getBalance()
api.getConversationList() -> api.messaging().getConversationList();
api.contact().delete() -> api.contact().remove()
api.event().createEvent() -> api.event(). remove()
api.event().editEvent() -> api.event().edit()
api.event().updateEventThumbnail() -> api.event().updateThumbnail()
api.event().deleteEvent() -> api.event().remove()
api.event().getGroupEvents() -> api.event().getGroupEventList()
api.event().getEventSubscriptions() -> api.event().getSubscriptionList()
api.event().subscribeToEvent() -> api.event().subscribe()
api.event().unsubscribeFromEvent() -> api.event().unsubscribe()
api.group().getHistory() -> api.group().getChatHistory()
api.subscriber().getHistory() -> api.subscriber().getChatHistory()
api.utility().group().member().checkPermissions() -> api.utility().group().member().hasCapability()
api.stage().getStages() -> api.stage().getStageList()
api.stage().getSettings() -> api.stage().getGroupSettings()
api.stage().getSlots() -> api.stage().getGroupSlots()
api.stage().removeSubscriberFromSlot() -> api.stage().kickSlot()
api.stage().play() -> api.stage().broadcast()
api.stage().isPlaying() -> api.stage().isBroadcasting();
api.messaging().subscribeToNextMessage() -> api.messaging().subscribe().nextMessage()
api.messaging().subscribeToNextGroupMessage() -> api.messaging().subscribe().nextGroupMessage()
api.messaging().subscribeToNextPrivateMessage() -> api.messaging().subscribe().nextPrivateMessage()
api.messaging().subscribeToNextGroupSubscriberMessage() -> api.messaging().subscribe().nextGroupSubscriberMessage()
Whats New?
- Full typings/intellisense support
- Bug fixes
- Contacts, Events, Groups, Group Members, Subscribers & Messages now contain methods
- Constants are now integrated into the API... Constants Package will be deprecated upon this release
- Constants names now start with a capital letter (EX: messageType is now MessageType)
- 10.14 Raise Hands Support
- Added:
api.group().getRecommendedList()
- Get recommended groups
Introduction
WOLF.js is a community maintained javascript library used to create Unofficial Bots
Required
- Node Version: 12+
- Visual Code
- WOLF.js - npm i @dawalters1/wolf.js
Optional Packages
- ioredis npm i ioredis
Getting Started
- Create a new repo using the following repo Bot Template
Config - './config/default.yaml'
keyword: keyword # single word only
app:
defaultLanguage: en
developerId: your_user_id # your user ID
commandSettings:
ignoreOfficialBots: true
ignoreUnofficialBots: false
networkSettings:
retryMode: 1 # retry requests on 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout & 408 Timeout
retryAttempts: 1
Phrases - './phrases/en.json'
[
{
"name": "{keyword}_command_{keyword}",
"comment":"{keyword} must match the keyword specified in config yaml",
"value":"!{keyword}"
},
{
"name": "{keyword}_command_help",
"value":"help"
},
{
"name": "{keyword}_help_message",
"value":"Welcome to the {botname} bot\n\n!{keyword} help - To display this message\n!{keyword} me - Display basic information about your profile"
},
{
"name": "{keyword}_command_me",
"value":"me"
},
{
"name": "{keyword}_subscriber_message",
"value":"Nickname: {nickname} (ID: {id})\nStatus Message: {status}\nLevel: {level} ({percentage}% completed)"
}
]
index.js
const WOLF = require('@dawalters1/wolf.js');
const api = new WOLF.WOLFBot();
const me = require('./src/me')
const keyword = api.options.keyword;
api.commandHandler().register([
new WOLF.Command(`${keyword}_command_${keyword}`, { both: async (command) => api.messaging().sendMessage(command, api.phrase().getByLanguageAndName(command.language, `${keyword}_help_message`)) },
[
new WOLF.Command(`${keyword}_command_help`, { both: (command) => api.messaging().sendMessage(command, api.phrase().getByLanguageAndName(command.language, `${keyword}_help_message`)) }),
new WOLF.Command(`${keyword}_command_me`, { both: (command) => me(api, command) })
])
]);
api.on('groupMessage', async(message)=>{
if(message.body === '!ping'){
return await api.messaging().sendGroupMessage(message.targetGroupId, 'Pong!');
}
});
api.on('privateMessage', async(message)=>{
if(message.isCommand){
return Promise.resolve();
}
const { language } = await api.subscriber().getById(message.sourceSubscriberId);
return await api.messaging().sendPrivateMessage(message.sourceSubscriberId, api.phrase().getByLanguageAndName(language, `${api.options.keyword}_help_message`));
});
api.on('ready', ()=>{
console.log('Ready');
});
api.login('email', 'password');
Command - './src/me/index.js'
/**
* Required for intellisense to work with api & command
* @param {import('@dawalters1/wolf.js').WOLFBot} api
* @param {import('@dawalters1/wolf.js').CommandObject} command
*/
module.exports = async (api, command) => {
const subscriber = await api.subscriber().getById(command.sourceSubscriberId);
return await api.messaging().sendMessage(
command,
api.utility().string().replace(api.phrase().getByLanguageAndName(command.language, `${api.options.keyword}_subscriber_message`),
{
nickname: subscriber.nickname,
id: subscriber.id,
status: subscriber.status,
level: subscriber.reputation.split('.')[0],
percentage: subscriber.reputation.split('.')[1], // you may have to pad left with 0s
}));
};
Approval
Bots MUST be approved by WOLF staff in bot approval or bot approval.ar
Known Issues
- Nothing at all ᴺᵒᵗʰᶦⁿᵍ ᵃᵗ ᵃˡˡ
Lacking Features
- Stage Volume Control - Wont Do
Contact
- You can receive help in unofficial bots
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago